SQLite: table has no column named (tested)
sqlite3.OperationalError: table X has no column named Y means an INSERT or UPDATE named a column that isn't in the table's schema. We reproduced two distinct ways this happens with a real table.
1. A typo'd column name
We created a table with a column named name, then inserted with a typo:
con.execute("CREATE TABLE t (id INTEGER, name TEXT)")
con.execute('INSERT INTO t (id, nmae) VALUES (1, "x")')
sqlite3.OperationalError: table t has no column named nmae
The error names the exact column it couldn't find, which makes a genuine typo easy to spot once you know to read that far into the message.
2. An extra column that was never in the schema
Using the same table, we inserted naming a column that was simply never defined:
con.execute('INSERT INTO t (id, name, extra) VALUES (1, "x", "y")')
sqlite3.OperationalError: table t has no column named extra
Measured: this is the identical error shape as the typo case — SQLite can't distinguish "you meant a different column" from "this column was never supposed to exist," because from its side both are the same fact: the name isn't in the schema. A common real cause is a schema migration (adding a column) that ran against one environment but not the one the INSERT is actually hitting.
3. The fix: check the schema the connection actually sees
Rather than re-reading the INSERT statement character by character, list the columns SQLite itself has for that table on this connection:
PRAGMA table_info(t);
This shows every column name exactly as stored, which immediately reveals a typo, a column that was dropped, or — if the list looks right but the error persists — that this connection is pointed at a different file than you expect (see our no such table guide for that case specifically).
Frequently asked questions
What does 'table X has no column named Y' mean?
An INSERT or UPDATE statement named a column that doesn't exist in the table's actual schema on the connection you're using. We reproduced this both from a genuine typo and from naming a column that was simply never created.
How is this different from a typo versus a genuinely missing column?
We measured both to give the identical error shape — SQLite only knows 'this name isn't in the schema,' not why. The only way to tell them apart is reading the schema yourself with PRAGMA table_info and comparing it to what you intended.
What's the fastest way to see a table's real columns?
PRAGMA table_info(tablename); — we used this to list every column SQLite actually has for the table, which immediately shows a typo or a column that was never added.
Could a half-applied migration cause this?
Yes — if a migration that adds a column ran against one database file or environment but not the one your INSERT is actually hitting, every insert naming the new column fails with this exact error, identical to a plain typo.
Does column order in the INSERT matter for this error?
No — we tested naming columns explicitly (INSERT INTO t (id, name) ...); the error only depends on whether each named column exists in the schema, not the order they're listed in.
Written with AI assistance. Measured on 2026-10-03 with Python 3.13.5's built-in sqlite3 module, using a real table and both a typo'd column name and an extra column in an INSERT statement. Every error string below is copy-pasted output, not paraphrased. PlainHeaders is our extension; Python's sqlite3 is built in.