SQLiteSQLite SQLITE_MISMATCH
SQLite: Datatype Mismatch
SQLite raises a datatype mismatch error when a value of an incompatible type is inserted into a column with strict type affinity, particularly INTEGER PRIMARY KEY columns.
Example Query
CREATE TABLE items (id INTEGER PRIMARY KEY);
INSERT INTO items VALUES ('not-a-number');Common Causes
- 1Inserting a non-integer into an INTEGER PRIMARY KEY column
- 2Using STRICT tables (SQLite 3.37+) with wrong data types
- 3ORM generating incorrect bind parameters
How to Fix It
Ensure values match the declared column type. For STRICT tables, cast values explicitly. SQLite's type affinity is flexible for most columns, but INTEGER PRIMARY KEY is always stored as a rowid integer.
Need a reliable database?
Try Supabase — free PostgreSQL with a generous free tier. No credit card required.
Got a query causing this error?
Paste it into SQLbuddy and get an instant plain-English explanation with optimization tips.
Analyze My Query →