App Finishers

Fix guide · updated 2026-11-15

Supabase "Could not find the column in the schema cache" (PGRST204)

400 · {"code":"PGRST204","details":null,"hint":null,"message":"Could not find the 'userId' column of 'todos' in the schema cache"}

Saving a form fails: an insert or an update comes back with "Could not find the 'userId' column of 'todos' in the schema cache", code PGRST204. Reading the same table works fine. PostgREST, the part of Supabase that answers database requests, compared the fields your app sent with the table's columns, and one of them isn't a column. The message tells you which one.

What the error means

This error only comes from writes: insert, update and upsert. PostgREST checks every key of the object you send against the table's columns. One unknown key, and the whole write is refused with a 400. We tested it on PostgREST 14.18, the version in Supabase's self-hosted setup: an insert, an update and an upsert with an unknown key all got PGRST204, and nothing was saved.

The message names the field and the table: 'userId' of 'todos'. Open the table in Supabase's Table Editor, compare its column names with that field, and pick the case below that fits.

1. The code and the table spell it differently

A frequent version: the code uses camelCase (userId, createdAt) and the table uses snake_case (user_id, created_at). Supabase sends your object's keys exactly as written; nothing converts them. Typos, singular versus plural and capital letters count too: a column created with quotes, like "userId", has to be sent with that exact capital.

// Table columns: id, title, user_id, created_at

// Wrong: PGRST204 "Could not find the 'userId' column of 'todos'"
await supabase.from('todos').insert({ title, userId: user.id });

// Right
await supabase.from('todos').insert({ title, user_id: user.id });

2. The object carries fields that aren't columns

Another common one: the app saves a whole object, such as a form's state or a row it loaded earlier with extra data attached. A field only the screen uses (isEditing), a nested object (profile) or a computed value is enough to fail. In our test, sending "profile": {"name": "a"} inside an insert gave PGRST204 for 'profile'.

Send only the columns:

const { title, user_id, due_date } = form;
await supabase.from('todos').update({ title, user_id, due_date }).eq('id', form.id);

3. The column doesn't exist in this project yet

The code expects a column that was never created in this Supabase project. With AI-built apps, it's often a migration that added the column, written but never run here. List the table's real columns in the SQL Editor:

select column_name, data_type
from information_schema.columns
where table_schema = 'public' and table_name = 'todos'
order by ordinal_position;

If the column is missing, add it. If your code has a supabase/migrations folder, search it for the column's name and run that SQL. Otherwise, add it yourself with the type it needs, for example:

alter table public.todos add column due_date date;

4. The column was just added

PostgREST keeps the list of columns in memory: that's the "schema cache" in the message. On Supabase, adding a column refreshes it by itself, through an event trigger in Supabase's Postgres (pgrst_ddl_watch). If a new column still fails a few seconds later, reload the cache yourself in the SQL Editor:

notify pgrst, 'reload schema';

In our test, a column added after PostgREST started gave PGRST204 until that line ran; the next insert worked.

Which "column" error do you have?

Keep it from coming back

TypeScript types generated from your database catch these mistakes in your editor, before anyone presses Save. Supabase's docs ("Generating TypeScript Types") use the Supabase CLI:

npx supabase login
npx supabase gen types typescript --remote="<project-ref>" --schema public > database.types.ts

Then create the client with them: createClient<Database>(url, key). Generate them again after each change to your tables: types from an older version of the database let the old names through.

If an AI tool built your app

Run the SQL query from section 3 first, then give your AI tool this prompt with its result pasted in:

My Supabase writes fail with PGRST204 "Could not find the '<column>' column of '<table>' in the schema cache". These are the table's real columns: <paste the query result>. Find every insert, update and upsert on this table, and make each one send only these columns, with exactly these names (for example user_id, not userId; drop fields only the screen uses and nested objects). If the code needs a column that doesn't exist, don't invent it: tell me, and give me the SQL to add it so I can run it myself. Don't change anything else.

Still stuck?

In your browser's developer tools, Network tab, click the failing request and open its Payload: it shows the exact keys your app sent. Compare each one with the column list from section 3.

Other Supabase problems? See Supabase fixes.