datatype mismatch SQL Origin: Data OSI layer 7 · Application Last updated 18 Nov 2026

SQLite: datatype mismatch (SQLITE_MISMATCH)

SQLite refused a value for a column with strict typing, such as a non-integer for an INTEGER PRIMARY KEY or a STRICT table column.

Exact message you may see datatype mismatchsqlite3.IntegrityError: datatype mismatchError: SQLITE_MISMATCH: datatype mismatchcannot store TEXT value in INTEGER column
Seen on: SQLite Python

Meaning

INTEGER PRIMARY KEY accepts only integers; STRICT tables enforce column types. Cast or fix the value, and don't store UUID strings in an INTEGER PRIMARY KEY (use TEXT PRIMARY KEY).

Common causes

  • Text inserted into INTEGER PRIMARY KEY
  • STRICT table type violation
  • UUID in an integer key column
  • Wrong parameter order
  • ORM sending the wrong type

⚡ Quick fix

  1. Use TEXT keys for UUIDs
  2. Cast/validate before inserting
  3. Check the table definition (.schema)

Detailed fix by platform

SQL

  1. CREATE TABLE items (id TEXT PRIMARY KEY, qty INTEGER); -- not INTEGER PRIMARY KEY for UUIDs

How to diagnose

  1. Column — INTEGER PRIMARY KEY?
  2. Value — Integer?
  3. Table — STRICT?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

Array to string conversion — Warning: Array to string conversion (PHP)Array to string conve…AttributeError — AttributeError: 'X' object has no attribute 'y' (Python)AttributeErrorCannot use object as array — Fatal error: Uncaught Error: Cannot use object of type stdClass as array (PHP)Cannot use object as …CASE — CASE expression returns mixed types: conversion failed / types cannot be matched (SQL)CASEClassCastException — java.lang.ClassCastException: class A cannot be cast to class B (Java)ClassCastExceptiondisk I/O error — SQLite: disk I/O error (SQLITE_IOERR) (SQL)disk I/O errorERR_INVALID_ARG_TYPE — TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined (Node.js)ERR_INVALID_ARG_TYPEImplicit float to int — Deprecated: Implicit conversion from float 2.5 to int loses precision (PHP)Implicit float to intdatatype …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.