psycopg.errors.UndefinedColumn: column "titel" does not exist
Python · updated 2026-11-10
Raised by Postgres (SQLSTATE 42703) when a query names a column the table does not have. psycopg raises UndefinedColumn, Django and SQLAlchemy wrap it as ProgrammingError, node-postgres throws it with code 42703. Postgres often adds a HINT such as Perhaps you meant to reference the column "todos.title".
Traceback (most recent call last):
...
psycopg.errors.UndefinedColumn: column "titel" does not exist
LINE 1: select titel from todos
^
HINT: Perhaps you meant to reference the column "todos.title".Quick fix
Read the HINT first: it usually names the column you meant. If the name is right, check its case: an unquoted createdAt is looked up as createdat, so a column created as "createdAt" must be quoted in raw SQL. If the column really is missing, the migration that adds it has not run on this database.
- Read the HINT line under the error; Postgres suggests the closest existing column.
- Compare case: unquoted names are lowercased, so camelCase columns need double quotes in raw SQL.
- List the real columns: \d tablename in psql, or select column_name from information_schema.columns where table_name = 'todos'.
- If the model has the field and the table does not, run the pending migration on this database.
- In a string literal mix-up (where name = "alice"), double quotes mean a column: use single quotes for values.
Why it happens
Model ahead of the database
A new field was added to the model or query and deployed, but the migration that adds the column never ran there.
Case folding
A camelCase column created with quotes ("createdAt") is not found by unquoted SQL, which looks for createdat.
Double quotes around a value
where name = "alice" asks for a column named alice. String values take single quotes.
Typo or a renamed column
The query still uses an old or misspelled name; the HINT usually shows the right one.
Other fixes
- Use query parameters instead of building SQL strings, which also removes the quote mix-up.
- Keep migrations in the deploy step so code and schema change together.
Same error, other wording
- error: column "createdat" does not exist
- django.db.utils.ProgrammingError: column app_order.status does not exist
- psycopg2.errors.UndefinedColumn: column "alice" does not exist
Let your coding agent catch the next one
Runheed records this error in production with the stack trace, the breadcrumbs before it and, when you set it, the agent session that shipped the code, and serves it to Claude Code, Cursor or any MCP client. With it connected, you can ask:
> Find the "column does not exist" errors, read each hint, and fix the query, the quoting or the missing migration so the code and the table match.
Setup for Python and FastAPI, Django or Flask, then have your agent fix and resolve it.
Related errors
- error: relation "todo" does not exist
- psycopg.errors.UniqueViolation: duplicate key value violates unique constraint...
- django.db.utils.OperationalError: no such table: orders_order
More in Databases
- PrismaClientKnownRequestError: Unique constraint failed on the fields: (`email`)Node.js
- PrismaClientInitializationError: Can't reach database server at `db.example.com:5432`Node.js
- MongoServerError: E11000 duplicate key error collection: app.users index: email_1 dup...Node.js
- [ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379Node.js
- psycopg2.OperationalError: server closed the connection unexpectedlyPython
- error: new row violates row-level security policy for table "todos"Node.js
- error: infinite recursion detected in policy for relation "members"Node.js
- error: permission denied for table profilesNode.js
- error: null value in column "total" of relation "orders" violates not-null constraintNode.js
- error: insert or update on table "orders" violates foreign key constraint...Node.js
- error: invalid input syntax for type uuid: "undefined"Node.js
- sqlalchemy.exc.PendingRollbackError: This Session's transaction has been rolled back due...Python
- sqlite3.OperationalError: database is lockedPython
- pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection...Python
- redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection...Python
References: PostgreSQL docs: identifiers and case folding, PostgreSQL docs: error codes (42703 undefined_column)
Spotted a mistake? Email hello@greatwork.company. About Runheed.