sqlite3.IntegrityError: NOT NULL constraint failed: table.column
A NULL went into a NOT NULL column in SQLite.
Exact message you may see
NOT NULL constraint failed
Seen on:
SQL
Meaning
Often an ORM model field not set, or a new NOT NULL column without a default in a Django/Rails migration.
Common causes
- Required field missing
- Migration added NOT NULL without default
- Explicit None/null
⚡ Quick fix
- Provide the value or a default
- Make the column nullable if appropriate
Detailed fix by platform
SQL
ALTER TABLE users ADD COLUMN status TEXT NOT NULL DEFAULT 'active';
How to diagnose
- Column — Which one?
- Input — Why null?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 23502 ERROR: null value in column "x" of relation "y" violates not-null constraint
- 2627 SQL Server: Violation of PRIMARY KEY constraint 'x'. Cannot insert duplicate key in object 'y'. (Msg 2627)
- 515 SQL Server Msg 515: Cannot insert the value NULL into column 'X', table 'Y'; column does not allow nulls
Most viewed in SQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Did this fix work for you?
Report a correction or suggest an improvement
Last updated 14 Oct 2026