Supabase "permission denied for table" after Oct 30: fix for AI-built apps
By Arif Khan, AIVolve LLC · Updated November 13, 2026
Short answer: from October 30, 2026, Supabase stops automatically opening up new tables in the public schema to the Data API on every existing project. (Projects created since about May 30, 2026 already work this way.) So when Lovable, Bolt, Cursor or another AI tool adds a new table, your app can't reach it until someone grants access, and requests fail with error 42501, "permission denied for table ...". Tables you already have keep working. The fix is to add a GRANT for each role that needs the table, keep Row Level Security (RLS) on, and add policies, all in the same migration. Below is how to tell if you're affected, the SQL, and a prompt you can paste into your AI tool.
You don't need to be a developer: you'll paste a few lines into a SQL editor, or a prompt into your AI tool.
What changed, in plain English
Supabase protects your data with two separate locks:
- Grants decide whether a role can touch a table at all. The roles your app uses are
anon(visitors who aren't signed in),authenticated(signed-in users) andservice_role(trusted server code). - RLS policies decide which rows each role can see or change, for example "users can only see their own orders."
Until now, every new table in public got the first lock opened automatically: select, insert, update and delete were granted to all three roles the moment the table was created. RLS was the only thing standing guard. Supabase is ending that default, because, in their words, "agents, CLI scripts, and AI platforms create tables too, and many of those operations do not have a human reviewing the diff."
After the change, a new table exists but the Data API can't see it until you add a grant. RLS itself works exactly as before.
Who is affected
You need to act if your app uses the Supabase client (supabase-js) or the REST or GraphQL API, and your AI tool or migrations create new tables in public without GRANT statements.
The change reaches you on one of these dates:
- October 30, 2026 for existing projects.
- From about May 30, 2026 for projects created since then. Supabase rolled this out gradually over a few weeks, so a project created in early June may or may not have it.
- Earlier, if someone unticked "Automatically expose new tables" when creating the project.
You are not affected for:
- Tables that already exist. They keep their current grants and stay reachable.
- Apps that only talk to the database over a direct Postgres connection (an ORM or server with a connection string).
- Tables in the
auth,storageorrealtimeschemas, or custom schemas.
What about Lovable Cloud (Lovable's built-in backend)? We couldn't confirm it either way. Lovable Cloud runs on a Supabase instance that Lovable provisions and manages for you, and as of October 22, 2026 we found nothing in Lovable's docs or changelog about this change. Don't guess: the check in Step 1 works on Lovable Cloud too, using More → Database → Manage → SQL editor. If it shows the new behavior, the same fix applies.
How to recognize it
The pattern: everything old works, the one new feature doesn't. Your AI tool added a feature with a new table, and now:
- the new list stays empty, or saving does nothing;
- you see a toast or console error saying "permission denied for table ...";
- your AI tool says the table and policies exist, but the feature still fails.
To confirm, open your published app, open the browser's developer tools (right-click → Inspect), go to the Network tab, and use the feature. Look for a failed request to /rest/v1/your_table. Supabase notes these errors often show up as 401 or 403 responses. The response body 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;"
}
The hint names the role and the missing permission. Treat it as a clue, not an instruction to copy (see Step 4).
Not the same error: if the message says "new row violates row-level security policy," the grant is fine and a policy is blocking the write. That's an RLS problem. Our 10-minute RLS check covers it.
Step 1: Check whether your project already has the new behavior
Open the SQL editor (Supabase dashboard → SQL Editor, or on Lovable Cloud More → Database → Manage → SQL editor) and run this query from Supabase's docs:
select
case d.defaclobjtype
when 'r' then 'tables'
when 'S' then 'sequences'
when 'f' then 'functions'
end as object_type,
a.grantee::regrole as role,
string_agg(a.privilege_type, ', ' order by a.privilege_type) as privileges
from pg_default_acl d
cross join lateral aclexplode(d.defaclacl) a
where d.defaclrole = 'postgres'::regrole
and d.defaclnamespace = 'public'::regnamespace
and a.grantee in ('anon'::regrole, 'authenticated'::regrole, 'service_role'::regrole)
group by 1, 2
order by 1, 2;
- If you see rows for tables that list
select,insert,updateanddeleteforanonandauthenticated, new tables are still opened automatically (for now). - If there are no rows for tables, or the rows only list privileges like
maintain,references,triggerandtruncate(noselect,insert,updateordelete), you already have the new behavior: every new table needs explicit grants.
Step 2: Find the new table and see who can reach it
Replace your_table with the table name from the error:
select grantee, privilege_type
from information_schema.role_table_grants
where table_schema = 'public'
and table_name = 'your_table';
If authenticated (and anon, if visitors should see it) has no rows, or only TRUNCATE, REFERENCES or TRIGGER, with no SELECT, INSERT, UPDATE or DELETE, that's the cause.
Step 3: Fix it: grant, enable RLS and add policies as one unit
Supabase's advice is to treat these three steps as a unit. If the grant is missing, Postgres rejects the request before RLS even runs. If the grant exists but RLS is off, anyone with your app's public key can read and change the table. You need both.
Here is a typical fix for a table where each signed-in user owns their own rows (a user_id column). Adjust the table name, and only keep the lines your app actually needs:
-- 1. Grant only what each role needs
grant select, insert, update, delete on table public.your_table to authenticated;
grant select, insert, update, delete on table public.your_table to service_role;
-- Only if signed-out visitors should READ this table:
-- grant select on table public.your_table to anon;
-- 2. Turn on Row Level Security
alter table public.your_table enable row level security;
-- 3. One policy per action
create policy "Users can read their own rows"
on public.your_table for select
to authenticated
using ( (select auth.uid()) = user_id );
create policy "Users can add their own rows"
on public.your_table for insert
to authenticated
with check ( (select auth.uid()) = user_id );
create policy "Users can update their own rows"
on public.your_table for update
to authenticated
using ( (select auth.uid()) = user_id )
with check ( (select auth.uid()) = user_id );
create policy "Users can delete their own rows"
on public.your_table for delete
to authenticated
using ( (select auth.uid()) = user_id );
If the error mentions a sequence ("permission denied for sequence ..."), the table uses a numbered ID and the role that inserts also needs grant usage, select on sequence public.your_sequence to authenticated;.
It's better to have your AI tool write this as a migration, so the fix lives in your code and isn't lost. Ask Lovable:
"A new table is failing with Supabase error 42501 'permission denied for table'. Since Supabase's October 30, 2026 change, new tables in
publicneed explicit GRANTs. Write a new migration foryour_tablethat: (1) grants only the privileges each role needs, toauthenticatedandservice_role, and toanononly if signed-out visitors must read it (select only); (2) enables row level security; (3) adds a separate policy for select, insert, update and delete using(select auth.uid()) = user_id. Don't use GRANT ALL or grant on all tables in the schema. Show me the SQL before you apply it and tell me which roles got which privileges."
Step 4: Don't "fix" it by granting everything to anon
The fastest-looking fix is to copy the hint, or to run a blanket statement like grant select, insert, update, delete on all tables in schema public to anon, authenticated. Please don't.
anonis anyone on the internet who has your app's public key, and that key is visible in your app's code by design.- A blanket grant opens every table in
public, including any where RLS was never turned on. Supabase's Security Advisor calls a public table without RLS one that "anyone with your project URL can read, edit, and delete." - Most tables (profiles, orders, messages, invoices) should give
anonnothing at all. Grantselecttoanononly for data that's meant to be public, like a list of published blog posts, and still keep RLS on.
Step 5: Check your existing tables are fine
Existing tables keep their grants, so nothing you already have should break on October 30. This query shows, for every table in public, whether signed-in users and visitors can read it and whether RLS is on:
select
c.relname as table_name,
has_table_privilege('authenticated', c.oid, 'select') as signed_in_can_read,
has_table_privilege('anon', c.oid, 'select') as visitors_can_read,
c.relrowsecurity as rls_on
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public'
and c.relkind in ('r', 'p')
order by 1;
Two things to look for: a table your app uses where signed_in_can_read is false (it will fail), and any table where visitors_can_read is true but rls_on is false (it's open to the world, fix that now). Supabase's Security Advisor and the Data API exposure badge in the Table Editor also point out tables worth reviewing, and Supabase says the advisor shows the fix SQL.
Step 6: Tell your AI tool once, so it stops happening
Supabase recommends updating your AI tool's instructions (or using Supabase's agent skill, which includes the grants step). In Lovable, add this to your project's Knowledge (More → Settings → Knowledge). In other tools, put it in the project rules or instructions file:
"Whenever you create a new Supabase table in the public schema, the same migration must include: CREATE TABLE; ALTER TABLE ... ENABLE ROW LEVEL SECURITY; explicit GRANT statements giving only the needed privileges to
authenticatedandservice_role(andselecttoanononly for truly public data); and a separate policy for each of select, insert, update and delete based onauth.uid(). Never use GRANT ALL or grant on all tables in schema public. If a request fails with 42501, check grants before changing policies."
How to confirm it's fixed
- Run the Step 2 query again. You should see rows for
authenticated(andservice_role) with the privileges you granted. - In a private browser window, sign in to your published app as a normal user and use the new feature: create, view, edit and delete an item.
- In the Network tab, the request to
/rest/v1/your_tableshould now succeed, with no42501. - Sign in as a second test account and check that it can't see the first account's items.
- Sign out and check that visitors can't see the data, unless it's meant to be public.
FAQ
Will my existing Supabase tables stop working on October 30?+
No. Supabase says existing tables keep their current grants and stay reachable. The change only affects new tables created in the public schema after it reaches your project.
What does error 42501 "permission denied for table" mean?+
It means the role making the request (anon for signed-out visitors, authenticated for signed-in users) has no grant on that table, so Postgres rejects the request before Row Level Security runs. Add the specific grant the role needs, with RLS and policies in the same migration.
Can I fix it by granting everything to anon?+
Don't. The anon role is anyone with your app's public key, which is visible in your app's code. Grant anon select only on data that is meant to be public, keep RLS on, and give signed-in users only the operations your app uses.
Is Lovable Cloud affected by the Supabase change?+
We couldn't confirm it. Lovable Cloud runs on a Supabase instance that Lovable manages, and as of October 22, 2026 we found no statement about this change in Lovable's docs or changelog. Run the default privileges query in More → Database → Manage → SQL editor to see how your project behaves.
My tables have RLS policies. Why do I still get permission denied?+
Grants and RLS are separate locks. Policies decide which rows a role can see, but the role needs a grant on the table first. If the grant is missing, the policies never run.
Still stuck?
If you've added the grants and the new feature still fails, the cause is usually something specific to how your app was generated. Our free App X-ray takes about 2 minutes and needs no code or passwords: you paste a prompt into Lovable, send us the report, and get a plain-English verdict on what works, what only looks done and your biggest risk. An AIVolve developer reviews every X-ray within 1 business day. Get a free X-ray →
Related: Supabase RLS for AI-built apps: the 10-minute check · Lovable + Supabase login loop: the real fix · Stripe works in test mode but not live · Supabase "Database error deleting user"
Written by Arif Khan, AIVolve LLC. VibeCoderSOS isn't affiliated with Lovable or Supabase. Dates, settings names and SQL were checked against Supabase's and Lovable's documentation on October 22, 2026, and may change.
Need help?
Start with a free X-ray: 2 minutes, no code or passwords. You'll get a plain-English verdict on what works, what only looks done, and your biggest risk.
Get a free X-ray →