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
permission denied for sequence profiles_id_seq: inserting into aserial/bigserialcolumn also needs the sequence:grant usage, select on sequence public.profiles_id_seq to authenticated;permission denied for schema api: a custom schema needsgrant usage on schema api to anon, authenticated;and must be listed under Exposed schemas in the API settings.permission denied for function get_stats: grantexecuteon that function to the role that calls it, and only to that role.
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
- Supabase “new row violates row-level security policy” – causes and fix
- “relation does not exist” in Postgres and Supabase – schema, quotes, search_path, cache
- Supabase Realtime subscribed but no postgres_changes events – the checklist
- Supabase “must be owner of table objects” – what it means and what to run instead
More in Supabase RLS and Storage · all guides