*For Kotlin model classes*
If you're assigning a **default value** to the primary key like this:
```kotlin
data class MyModel(
@PrimaryKey(autoGenerate = true) val id: Int = defaultValue
)
```
**Make sure default value is `0` for `Long` and `Int` types.**
---
From the `autoGenerate` comment:
> If the field type is `long` or `int` (or its TypeConverter converts it to a `long` or `int`), `Insert` methods treat `0` as **not-set** while inserting the item.
In my case, I used `-1` as the defaultValue and this error was occurring.