Blog ·

Supabase error 42501 permission denied on a new table? Add the missing GRANT

You built your app with Lovable, Bolt, Cursor or Replit, and it uses Supabase. It worked. Then you asked your AI tool to add a feature, such as user profiles, a waitlist or a settings page, and now that part fails. Sign-up stalls on the profile step, or a dashboard panel stays empty, and the browser console shows 42501 and permission denied for table.

Your old tables still work. Only the new one fails. That pattern points to a change Supabase announced for 30 October 2026.

The short answer

Supabase's changelog says that from 30 October 2026, new tables in the public schema are no longer exposed to the Data API automatically, on all projects. The Data API is what your app's frontend uses through the Supabase library (supabase-js), and it covers the /rest/v1/ and /graphql/v1 addresses. Supabase says existing tables are not affected: they keep their current access and stay reachable.

So a table created after the change has no access for the roles your app uses (anon for logged-out visitors, authenticated for signed-in users) until you grant it. Postgres rejects the request before Row Level Security (RLS) is even checked. The fix is a few lines of SQL that grant access to that table, with RLS left on.

Supabase says this applies however the table was made: the SQL editor, migrations, the CLI, its MCP server or an AI coding tool.

How to tell if this is your problem

Open your live site, open the developer tools (F12 on most computers), and try the step that fails. In the Network tab, look for a request to an address like https://<project_id>.supabase.co/rest/v1/<table_name>. Supabase's changelog shows the error response looks like this:

{
  "code": "42501",
  "message": "permission denied for table your_table",
  "hint": "Grant the required privileges to the current role with: GRANT SELECT ON public.your_table TO anon;"
}

Three signs it is this change and not something else:

  • the table in the message is one you (or your AI tool) created recently
  • older tables in the same app still load
  • the hint line names the exact GRANT that is missing, including the role

Supabase's Security Advisor in your dashboard also flags tables affected by the change.

If you see an empty list with no error at all, that is a different problem: usually RLS is on with no policy that lets the user read their rows. See our post on empty dashboards for new users.

Fix it in three steps

1. Grant access to the new table

In your Supabase dashboard, open the SQL editor and run the grants for each new table, replacing your_table with its name. This is the pattern from Supabase's changelog:

grant select on public.your_table to anon;
grant select, insert, update, delete on public.your_table to authenticated;
grant select, insert, update, delete on public.your_table to service_role;

Only grant what each role needs. If logged-out visitors should never read this table, leave out the anon line. Grant service_role too if a server or Edge Function uses the service key on this table.

If your table uses an auto-incrementing number as its id (a serial or bigserial column) and inserts still fail, the role may also need access to the sequence behind it. Supabase's rollback SQL grants usage, select on sequences for this reason:

grant usage, select on sequence public.your_table_id_seq to authenticated;

Functions you call with supabase.rpc() need their own grant. Supabase's docs show:

grant execute on function public.your_function() to anon, authenticated;

2. Keep RLS on and add a policy

Supabase says RLS behaviour is unchanged and grants are a separate layer. Grants decide which roles can reach a table at all. RLS decides which rows they can see or change. Supabase's docs say to use both for every exposed table, and warn that a table exposed without RLS can be accessed by any role with matching grants.

So do not "fix" a 42501 by switching RLS off. Check RLS is on and add a policy, for example letting signed-in users read their own rows:

alter table public.your_table enable row level security;

create policy "users can read their own rows"
on public.your_table for select
to authenticated
using (auth.uid() = user_id);

Add matching policies for insert, update and delete if your app does those.

Be careful with one shortcut. Supabase gives a rollback that grants access on all tables in public at once. It works, but it also exposes any table that has RLS switched off. Granting per table is safer.

3. Test on the live site

Open your live site in a private browser window, sign up as a new user and go through the step that failed. Check the Network tab: the request to /rest/v1/your_table should now succeed. Then make sure you only see your own rows.

Check your project before it bites

Supabase's changelog dates this change as follows: an opt-out option at project creation from 28 April 2026, the new behaviour as the default for new projects from 30 May 2026 (rolled out gradually), and all existing projects from 30 October 2026. Rather than relying on the dates, check your own project:

  • In your project's Data API settings, see whether new tables are exposed automatically.
  • Run the default privileges query in Supabase's "Securing your API" guide to see what new tables in public will get.
  • Open the Security Advisor and look for warnings about tables without grants.

When you ask your AI tool to add a feature that needs a new table, ask it to include the grants and RLS policies in the same migration.

A prompt you can paste into your AI tool

"My app uses Supabase. Since adding [feature], the browser shows error 42501 'permission denied for table [table name]'. Supabase no longer exposes new tables in the public schema to the Data API automatically, so this table needs explicit grants. Write a migration that grants only the access my app needs on [table name] to anon, authenticated and service_role, plus sequence usage if the id is a serial column. Keep Row Level Security enabled and add policies so signed-in users can only read and change their own rows. Do not disable RLS and do not grant on all tables. Show me the SQL before you apply it."

Then test the step again on the live site in a private window.

Catch silent breaks before your users do

This kind of break is easy to miss because the page itself still loads fine. Scheduled testing from FlowCanary is launching by 30 November 2026. Once it is live, it will test the flows a new visitor can do in your app, such as sign-up and checkout, in a real browser on a schedule, with logged-in flows on Pro, and tell you in plain English when one breaks, with a fix prompt for Lovable, Bolt, Cursor or Replit. Until then, the free check works today: paste your live URL and it opens the page in a real browser and reports JavaScript errors, failed requests and blank pages.

Sources

Run the free checker