Supabase "permission denied for table" (42501) on new tables: the 30 Oct 2026 GRANT change and the safe fix
Updated 5 November 2026
You (or Lovable, Bolt, v0 or Cursor) created a new table, and now every query from your app fails with permission denied for table your_table and code 42501. Your old tables still work. This is Supabase's planned change of 30 October 2026, not a bug, and the fix takes one or two lines of SQL. The risk is fixing it too broadly.
Check your own app for this, free.
Paste your live URL. ShipCheck looks for leaked API keys in your page and JavaScript, exposed files like /.env and /.git, missing security headers, SSL certificate problems, domain expiry (custom domains only) and what Google sees without running JavaScript. You'll see your score without signing up.
Short answer
New tables in the public schema no longer get automatic access for the anon and authenticated roles. Add a grant for exactly what your app does with that table, usually to authenticated only. Keep Row Level Security on, with policies. Don't grant everything to anon, and don't switch RLS off to make the error go away.
What changed on 30 October 2026
Supabase announced this in its changelog: Tables not exposed to Data and GraphQL API automatically.
- Before: every new table in
publicautomatically gotselect,insert,updateanddeleteforanon,authenticatedandservice_role. It was reachable through the Data API (supabase-js,/rest/v1/, GraphQL) the moment it existed. - Timeline: optional for new projects from 28 April 2026, the default for new projects from 30 May 2026, and applied to all existing projects on 30 October 2026.
- Now: a new table exists, but the Data API can't reach it until you grant access. This holds however the table was created: SQL editor, migrations, CLI, the Management API, MCP or an AI coding tool.
- Not affected: tables that existed before the change keep their current grants. Apps that only talk to Postgres over a direct connection (psql, an ORM, a server with a connection string) aren't affected.
- RLS is unchanged. Supabase's order for each new table is: grant, enable RLS, add policies.
Why Supabase did it
Automatic grants meant any table was public-facing the moment it was created. A table an AI tool added for internal data was reachable with your public key, and only RLS stood in the way. If RLS was off, the data was open. Now exposure is an explicit choice. It stops new tables leaking by accident. It doesn't fix tables that are already exposed, so those still need checking.
Grants vs RLS: two separate locks
- A grant decides whether a role (
anonfor logged-out visitors,authenticatedfor signed-in users) can touch the table at all, and with which commands. With no grant, Postgres rejects the query with 42501 before RLS runs. - RLS decides which rows that role can see or change. With a grant and RLS on but no policy, the query succeeds but returns no rows (and writes fail with an RLS error). With a grant and RLS off, the role gets every row.
So the error is the grant layer saying no. The fix is a grant. Turning off RLS does nothing for 42501, and if you later add a broad grant, the table is wide open.
The narrow fix
Work out who uses the table and how, then grant only that. A typical table of per-user data that only signed-in users touch:
-- 1. Grant only what signed-in users need (RLS still applies)
grant select, insert, update, delete on table public.notes to authenticated;
-- 2. Make sure RLS is on
alter table public.notes enable row level security;
-- 3. Policies: each user only their own rows
create policy "read own notes" on public.notes
for select to authenticated using ((select auth.uid()) = user_id);
create policy "insert own notes" on public.notes
for insert to authenticated with check ((select auth.uid()) = user_id);
create policy "update own notes" on public.notes
for update to authenticated
using ((select auth.uid()) = user_id) with check ((select auth.uid()) = user_id);
create policy "delete own notes" on public.notes
for delete to authenticated using ((select auth.uid()) = user_id);- Only grant what the app uses. If users never delete, leave out
delete. A read-only table for signed-in users gets justgrant select … to authenticated. anonusually gets nothing. Grantselecttoanononly for content logged-out visitors really see (a public product list, published posts), with a policy that limits which rows. Grantinserttoanononly for something like a waitlist form, with a policy that checks the input.- Server-only tables (webhook logs, admin data, internal jobs): grant nothing to
anonorauthenticated. Your server code that uses the secret orservice_rolekey needsgrant … to service_roleto reach the table through the Data API. - Functions called with
supabase.rpc()needgrant execute on function public.fn() to authenticated, as in Supabase's Securing your API guide.
The writing side of policies (with check, stopping users moving rows to another account) is covered in Supabase RLS for insert, update and delete.
What not to do
grant all on all tables in schema public to anon, authenticated;This undoes the protection on every table at once, including ones you never meant to expose.- Reverting to the old default privileges for all future tables, just so the error stops.
alter table … disable row level security. It doesn't fix 42501, and combined with a grant it makes every row public.- Accepting an AI fix you haven't read. When you paste the error into Lovable, Bolt or Cursor, check the SQL it writes. Ask for: "a grant only to authenticated, only the commands this feature needs, keep RLS enabled, and show me the policies".
Make your AI builder do it right next time
Add a line to your project rules or system prompt: "Every new Supabase table needs, in the same migration: explicit grants to only the roles that need it (usually authenticated), enable row level security, and policies. Never grant to anon unless I ask." Supabase's changelog also points to its agent skill, which includes the grant step.
How to test
- See the current grants:
Every row forselect grantee, table_name, string_agg(privilege_type, ', ') as privileges from information_schema.role_table_grants where table_schema = 'public' and grantee in ('anon', 'authenticated') group by grantee, table_name order by table_name, grantee;anonshould be a table you really mean to be public. - Check RLS is on everywhere:
select tablename, rowsecurity from pg_tables where schemaname = 'public';Every row should saytrue. - Test as a logged-out visitor, with only your public key (the one in your frontend):
For a private table you want a 42501 error (no grant) orcurl -s "https://YOUR-PROJECT.supabase.co/rest/v1/notes?select=*&limit=1" \ -H "apikey: YOUR_PUBLISHABLE_OR_ANON_KEY"[](grant plus RLS with no matching policy), never real rows. With a legacyeyJ…anon key, also send-H "Authorization: Bearer YOUR_ANON_KEY". - Test as two different signed-in users in the app. Each should see and change only their own rows.
- Run Security Advisor in the Supabase dashboard. It flags tables with RLS off and other exposure problems.
For reading-side checks on existing tables, see the Supabase RLS checker guide. For the whole pre-launch list, see the vibe-coded app security checklist.
Checklist
- A 42501 error on a new table means a missing grant, not broken RLS.
- Grant each table only the commands the app uses, usually to
authenticatedonly. anongetsselectonly on truly public content, or nothing.- Server-only tables get grants to
service_roleonly. - RLS is on for every table, with policies for each command you granted.
- No blanket
grant all … to anon, and default privileges weren't restored. - Tested as logged-out, as user A and as user B. Security Advisor is clean.
- Your AI tool's rules include grant, RLS and policies for every new table.
What ShipCheck checks here (and what it doesn't)
The free scan checks your live site from the outside. It sees whether your app uses Supabase and looks for secret keys (like service_role or sb_secret_) in your page and JavaScript. It doesn't query your tables. Once you verify you own the app (a free account is enough), ShipCheck can also run a read-only table test. Using only your app's public key, it lists the tables the Data API exposes (up to 60), sends a count-only request to each, and reports any that return rows to an anonymous visitor. It never downloads row data. That catches a too-broad anon grant combined with missing or permissive RLS. It doesn't test writes, signed-in users, or grants that aren't in use yet, so steps 1, 2 and 4 above are still yours. Paid plans re-scan weekly on Solo ($12/mo) or daily on Builder ($29/mo).
FAQ
Why do I get 'permission denied for table' (42501) on a new Supabase table?
Since 30 October 2026, Supabase no longer automatically grants anon and authenticated access to new tables in the public schema of existing projects (new projects have had this since 30 May 2026). Until you add an explicit GRANT, the Data API (supabase-js, REST, GraphQL) can't reach the table and Postgres returns 42501. Existing tables keep their grants.
What's the safe fix for Supabase error 42501?
Grant only what your app needs, usually to the authenticated role, for example: grant select, insert, update, delete on table public.notes to authenticated. Keep RLS enabled and add policies that limit each user to their own rows. Grant to anon only for content logged-out visitors really need, and never blanket-grant all tables.
Should I disable RLS to fix permission denied for table?
No. 42501 comes from the grant layer, which runs before RLS, so disabling RLS doesn't fix it. If you add a broad grant with RLS off, anyone with your public key can read and change every row.
Does the 30 October Supabase change make my existing tables safe?
No. Existing tables keep the grants they had, so any table that was readable by anonymous users before is still readable. Check RLS and policies on every existing table, and use Security Advisor.
What's the difference between a GRANT and an RLS policy in Supabase?
A GRANT decides whether a role can access a table at all, and with which commands (select, insert, update, delete). RLS policies decide which rows that role can see or change. You need both: a grant so the app can reach the table, and RLS so each user only gets their own rows.
Does ShipCheck test my Supabase grants?
Partly. After you verify you own the app with a free account, ShipCheck uses your public key to count rows in each table the Data API exposes (up to 60) and flags tables an anonymous visitor can read. It never downloads row data. It doesn't test writes, signed-in access or unused grants. The anonymous free scan doesn't query tables at all.
Run the same checks on your app.
A free scan takes under a minute. No card, and no sign-up to see your score and the list of issues.