Could not find the column in the schema cache
An insert or update sent a field that Supabase’s API doesn’t know as a column of that table, so it refused the whole write.
Also appears as
- {"code":"PGRST204","details":null,"hint":null,"message":"Could not find the 'avatar_url' column of 'profiles' in the schema cache"}
Prompt to fix it
Saving fails with "Could not find the 'avatar_url' column of 'profiles' in the schema cache" (PGRST204). Compare the fields this code sends with the table’s real columns. If the column should exist, write the migration that adds it, then reload the schema cache with NOTIFY pgrst, 'reload schema'. If the key is misspelled, camelCase, or only used by the UI, map the data to the table’s exact columns before saving. Then generate Supabase types so mismatches show up as type errors. Don’t drop fields the user needs to save.
Paste into Layerwise or any AI coding tool.
What it means
Supabase’s API (PostgREST) keeps a schema cache: a snapshot of your tables and columns that it reads at startup and after schema changes. When an insert, update, or upsert sends a key that isn’t a column in that snapshot, the API stops with code PGRST204 and names the key and the table.
Most of the time the column really is missing. An AI tool adds an avatar field to the profile form and sends avatar_url, but no migration added the column. Names must match exactly, so avatarUrl in the code doesn’t match avatar_url in the table either.
Sometimes the column exists and the cache is stale. Supabase normally refreshes it after a schema change, but if a column you just added still triggers this error, run notify pgrst, 'reload schema'; in the SQL editor. Also watch for whole form objects passed straight to insert: fields only the UI uses, like confirmPassword, count as columns too.
Common causes
- The code sends a field for a column that was never added to the table.
- The key in the code is spelled or cased differently from the column, like
avatarUrlandavatar_url. - A whole form or state object goes to
insert, including fields the table doesn’t have. - The column was just added, and the API’s schema cache hasn’t reloaded yet.
- The app points at a different Supabase project, where the column doesn’t exist.
How to fix it
- Compare the keys the code sends with the table’s columns in the Table Editor.
- If the column should exist, add it with a migration, like
alter table profiles add column avatar_url text;. - If the key is misspelled or only used by the UI, map the form to exactly the table’s columns before saving.
- If the column exists, reload the cache with
notify pgrst, 'reload schema';and try again. - Generate types with
supabase gen types typescriptand pass them tocreateClient, so TypeScript flags unknown fields.
Example fix
-- Add the column the code sends.
alter table profiles add column if not exists avatar_url text;
-- Make the API pick up the change right away.
notify pgrst, 'reload schema';Related errors
All errorsColumn does not exist
A query names a column the table doesn’t have, often because of a migration that never ran, a camelCase name, or text in double quotes.
Relation does not exist
The query names a table that Postgres can’t find in this database, usually because it was never created here or has a different name.
Property does not exist on type
TypeScript can’t find that field on the type it has for this value, either because the type is wrong or because the value might not have it.
New row violates row-level security policy
Postgres refused to save a row because no row-level security policy on that table lets the current user write it.
Build with an agent that checks its work
The Layerwise agent clicks through the live preview and reads the console, so it catches errors before you do.