Could not find the table in the schema cache (Supabase PGRST205)
Filed under Supabase & databases
The API layer in front of your database (PostgREST) hasn't registered that table — because it was just created, because it lives in a schema the API doesn't expose, or because your app is asking a different project entirely.
Fastest route
Give your AI this prompt
Copy it, replace the bracketed part with your error, and send it.
Preview the prompt
My Supabase app is failing with: "Could not find the table 'public.[table]' in the schema cache" (PGRST205). The table definitely exists in my dashboard's Table Editor. Please: 1) check the exact table name and schema my code queries with .from() and tell me any mismatch in spelling, capitals, or schema, 2) check every place the Supabase URL and keys are set (local env and deployment env) and tell me the project ref each one points to, so we can rule out the app asking a different project, 3) give me the exact SQL to run in the SQL Editor to reload the schema cache, and the dashboard path to confirm the schema is exposed under Settings → API if it isn't public, 4) only after the table is found, check that the anon/authenticated roles have grants and an RLS policy, and report that as a separate issue if it's missing. Constraints: do not recreate the table, do not rename things at random, and do not switch the app to the service role key to make the error disappear. Make one change at a time and tell me how to test it.
Fix it yourself
Follow the repair
- Give a new table a minute. If you created the table and immediately ran the app, wait sixty seconds and try again. The schema cache reload is automatic and quick; a large share of these errors are simply impatience, and every "fix" attempted in the meantime only muddies the water.
- Reload the schema cache by hand. Open the SQL Editor in your Supabase dashboard and run
NOTIFY pgrst, 'reload schema';— that is the API's doorbell: it rebuilds its map of your tables immediately. Retry the app. If the error clears, it was a stale cache and nothing more. - Check the name and schema match exactly. In the Table Editor, note the schema shown for your table (usually
public) and the exact spelling, capitals included. Your app asks forsupabase.from('notes')— if the table isNotes, or it lives in another schema and your code never names that schema, the API honestly cannot find what you asked for. Rename to simple lowercase, or fix the code to match reality. - Expose the schema if it isn't public. For tables outside
public: go to Settings → API → Exposed schemas and make sure your schema is listed, then reload the cache again (step 2). Until a schema is exposed, its tables do not exist as far as the API is concerned. - Verify the app is asking the right project. Find your project's reference ID in the dashboard URL, and compare it with the ref inside your app's Supabase URL (
https://YOUR-REF.supabase.co) in its environment variables — including the deployed copy on Vercel, not just your local file. A mismatch here produces this exact error while everything in the dashboard looks correct, because both projects are fine; they're just different projects. - Then check access, as a separate problem. Once the API can see the table, the asking role (
anonorauthenticated) still needs permission grants, and row-level security needs a policy that lets the rows through. If your error changes to a permission-denied or row-level-security message, celebrate quietly: you fixed this problem, and the new message is the trailhead of a different, well-documented one.
Why this happensOptional explanation
Your app never talks to Postgres directly. It talks to PostgREST, which reads your database structure once and keeps it in a "schema cache" so it can answer quickly. When you ask for a table that isn't in that cache, PostgREST doesn't go looking — it reports the table as not found, even while the table sits there perfectly healthy in the Table Editor.
The cache normally refreshes itself when the schema changes, which is why this error is often self-inflicted timing: the table was created thirty seconds ago and the app asked too soon. The structural causes last longer. Tables created in a schema other than public are only reachable if that schema is on the API's exposed list. A table created through SQL with a quoted name keeps its capital letters forever, so Users and users are different tables as far as the API is concerned. And the most common cause in AI-built projects is project confusion: the table exists in the project open in your browser, while the app's environment variables hold the URL and keys of an earlier, test, or duplicate project.
- Just created: the cache hasn't caught up with a table made moments ago.
- Wrong schema: the table isn't in
public, or that schema isn't exposed to the API. - Name mismatch: capitals or spelling differ from what the app asks for.
- Wrong project: the app's keys belong to a different Supabase project than the dashboard you're looking at.
Quick answers
Did I lose my table?
No — it means the API layer (PostgREST) doesn't know the table yet or can't see it. Your data is untouched. The table may need a schema-cache reload, or it lives in a schema that isn't exposed in Settings → API.
How is this different from a permission or RLS error?
Different layers. 'Schema cache' means the API can't find the table at all. A 'permission denied' or row-level-security error means the API found it, but the role asking isn't allowed — that's grants and policies, a different fix.
It worked in the dashboard but not in my app. Why?
Usually how long you waited. A brand-new table appears within moments; if it's still missing after several minutes, the cause is structural — wrong schema, unexposed schema, or keys from a different project — and waiting won't cure it.