Mendlark / Guides

Supabase "Could not find the column in the schema cache" (PGRST204): how to fix it

Your Lovable, Bolt or Cursor app calls .insert() or .update() and the console shows Could not find the '…' column of '…' in the schema cache with code PGRST204. PostgREST compared every key in your write to its copy of the table. One key is not an exact column name — usually camelCase vs snake_case, a form-only field, a nested relation, or a column the migration never created.

Stuck on this? Get it fixed for €49.

Fixed in 48 hours or you don't pay. Launch deal for the first 5 customers (normally €79). You get the tested fix as a pull request, so nothing changes until you merge it.

Get it fixed for €49

1. Read the column and the table out of the message

The error looks like Could not find the 'phoneNumber' column of 'profiles' in the schema cache with code PGRST204 (HTTP 400). The first quoted name is the key your Lovable, Bolt or Cursor app sent. The second is the table. Open the Network tab, find the failed /rest/v1/… request, and confirm the JSON body really sends that key. A body of PGRST205 is a missing table — see Could not find the table in the schema cache.

// This fails if profiles has phone_number, not phoneNumber
const { error } = await supabase
  .from('profiles')
  .insert({ id: user.id, phoneNumber: value })

2. Compare that key to the real columns

Names must match letter for letter. userId does not match user_id. Unquoted Postgres names fold to lower case, so a column created as PhoneNumber is stored as phonenumber. List the real names:

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

Then change the object you pass to insert, update or upsert so every key is one of those names. Drop keys that are not columns (form-only fields like confirmPassword, or nested relations).

3. Nested inserts are not columns

This looks right because the same shape works on reads, but PostgREST treats every write key as a column of that one table:

// Fails: order_items is not a column of orders
await supabase.from('orders').insert({
  customer_id: user.id,
  total: 42,
  order_items: [{ product_id: 7, quantity: 2 }],
})

Insert the parent first (ask for id back), then insert the child rows with that foreign key. If both must succeed together, put them in one Postgres function and call it with .rpc().

4. Add the column only if it was never created

If information_schema has no row for the field you mean, the migration never ran on this project. Add the column with an unquoted snake_case name, then send that name from the client. Do not add a second camelCase column beside the one you already have. Turning off Row Level Security does not fix a missing column.

alter table public.profiles
  add column if not exists phone_number text;

5. Reload the schema cache if the column is already there

If the column exists in the Table Editor and the API still returns PGRST204, PostgREST's cache is stale. Run this in the SQL Editor, then retry the write:

NOTIFY pgrst, 'reload schema';

Do not restart the project first. A Postgres 42703 on a select is a wrong name in SQL, not a stale cache.

Quick checklist

  • Confirm the code is PGRST204, not PGRST205
  • Match keys to information_schema names exactly
  • Do not nest related rows inside an insert
  • Add a missing column with a migration, then use that name
  • If the column exists, NOTIFY pgrst, 'reload schema'

Stuck on this? Get it fixed for €49.

Fixed in 48 hours or you don't pay. Launch deal for the first 5 customers (normally €79). You get the tested fix as a pull request, so nothing changes until you merge it.

Get it fixed for €49

Still stuck?

Mendlark fixes this kind of problem for a fixed €49 (launch price, normally €79). We agree the problem first, test the fix and send it as a pull request, so nothing changes in your app until you merge it. If we can't fix it, you don't pay. Get the €49 fix, or start with a free scan.

Not sure what else is wrong? Paste your app link into the free instant check and get a plain-English list of problems in seconds.