Supabase “permission denied for table” – a missing GRANT, not a missing policy

By Abheesht Tripathi · Published

permission denied for table profiles  (code 42501)

What it means

Postgres checks two layers on every request. First the table privileges (GRANT): may this role touch this table at all? Then the Row Level Security policies: which rows may it see or write? This error is the first layer. The role your request ran as has no privilege for that operation on that table, so RLS never even ran.

Which role? Signed-out requests run as anon, signed-in requests as authenticated, and requests made with the secret / service_role key as service_role. A missing RLS policy looks different: reads return an empty list and writes fail with “new row violates row-level security policy”.

Projects on the new defaults also return a hint such as Grant the required privileges to the current role with: GRANT SELECT ON public.profiles TO anon;

Why new tables hit it in 2026

Supabase used to set default privileges so that every new table in public was granted to anon, authenticated and service_role automatically. Supabase changed that: from 30 May 2026 new projects stop doing it by default, and from 30 October 2026 the same applies to existing projects. Per Supabase's changelog, any new table created in public without an explicit grant is not reachable via the Data API. Existing tables keep their grants.

So the classic symptom is: old tables work, the table from last week's migration returns 42501. Tables in your own custom schemas never had automatic grants, so they always needed this.

The fix

Grant only what each role needs, in the same migration that creates the table, then turn on RLS and write policies. Grants decide whether a role can use the table; RLS still decides which rows.

-- signed-out visitors may read (leave this out if they shouldn't)
grant select on table public.profiles to anon;

-- signed-in users; rows are still filtered by the policies below
grant select, insert, update, delete on table public.profiles to authenticated;

-- server code that uses the secret / service_role key
grant select, insert, update, delete on table public.profiles to service_role;

alter table public.profiles enable row level security;

create policy "read own profile" on public.profiles
  for select to authenticated
  using ((select auth.uid()) = id);

Variants of the same error

How to verify

List what each role holds on the table:

select grantee, privilege_type
from information_schema.role_table_grants
where table_schema = 'public' and table_name = 'profiles'
order by grantee, privilege_type;

Then repeat the request from your app as a signed-in user. You should get rows (or an empty list if no policy matches) instead of 42501. An empty list now means you are on layer two: check your policies.

What not to do

Don't paste grant all on all tables in schema public to anon as a blanket fix. It also opens tables you meant to keep private, and any of them without RLS becomes readable and writable by anyone holding your publishable key. Grant per table, and for private tables run revoke all on table public.my_private_table from anon, authenticated;

Related guides

More in Supabase RLS and Storage · all guides