The Zeroic Journal

Supabase permission denied for table on new tables

Supabase stopped granting API access to new tables on October 30. Here's why your AI builder's new feature broke, the fix, and the rule that keeps it fixed.

On this page 6 sections
  1. Why Supabase permission denied for table appears
  2. A missing grant fails loudly, RLS quietly
  3. The three-line fix for each table
  4. Stop your AI builder from repeating it
  5. Which fix fits your situation
  6. WordUp Tutoring: from one build to a retainer

Supabase permission denied for table (error 42501) on a table you just created means the table has no grants. Since October 30, 2026, Supabase no longer grants new public tables to its API roles automatically. Fix it with three GRANT statements per table, keep row level security on, then add a rule so your AI builder stops repeating it.

That’s the whole diagnosis for most founders who landed here. A feature your Lovable, Bolt or Cursor agent built last week worked. Today the agent added a table for the next feature, and that screen shows nothing, or an error toast, or a 401 or 403 in the network tab. Nothing in your code changed. Supabase’s defaults did.

Why Supabase permission denied for table appears

Until this year, every new table in the public schema was automatically granted select, insert, update and delete for the anon, authenticated and service_role roles. That meant any table your agent created was reachable through the Data API the moment it existed. Supabase’s changelog on the breaking change lays out the switch in three dates:

  • April 28, 2026: new projects could opt out of automatic exposure.
  • May 30, 2026: opting out became the default for new projects.
  • October 30, 2026: the new behavior applied to all existing projects.

Now a new table is reachable through the Data API only after an explicit GRANT. Supabase says existing tables are not affected and keep their current grants, so the break shows up only on tables created after the change. That’s why it looks random: the old screens work and the new one doesn’t.

The API response tells you exactly what’s missing. Per the same changelog, it returns code 42501, the message permission denied for table your_table, and a hint naming the role and the GRANT you need. Supabase’s 42501 troubleshooting page adds that this Postgres code usually reaches your app as a 401 or 403, which is why an agent reading only the status code often blames your login flow instead.

A missing grant fails loudly, RLS quietly

Your project has two locks on every table, and AI builders tend to mix them up. Supabase’s guide to securing your API puts it in two sentences: grants control whether a role can access an object; row level security (RLS) controls which rows the role can access.

The two fail differently:

  • No grant: the request is refused outright with permission denied for table. Postgres stops at the grant check, so none of your RLS policies are ever read.
  • Grant, RLS on, no matching policy: reads succeed and return an empty list. The Supabase RLS guide says that once RLS is enabled, no data is accessible with the publishable key until you create policies. Inserts without a policy fail with the same 42501 code but a different message: new row violates row-level security policy.

This is where agents make the bug worse. Asked to fix a 42501, an agent will often write more policies (which can’t help, because the grant check comes first) or turn RLS off (which doesn’t clear the error and leaves the table unprotected once the grant lands). If the message says permission denied for table, it’s a grant. If the data comes back empty, it’s a policy, and our guide to why Supabase row level security fails walks through those six causes.

The three-line fix for each table

Run this in the SQL editor for each new table, or better, add it to the migration that created the table. These are the grants Supabase’s changelog recommends:

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

alter table public.bookings enable row level security;

Then write the policies the feature needs. Three adjustments make this safer than copying it blindly:

  • Drop the anon line if logged-out visitors never read the table. A grant is permission to try. Least privilege means granting only the verbs each role uses, so a policy written too broadly later can’t expose the table to anyone with your public key.
  • Check what a table has. Supabase’s troubleshooting page gives the query: select grantee, privilege_type from information_schema.role_table_grants where table_name = 'bookings'; An empty result for anon and authenticated confirms the diagnosis.
  • Watch for the second error. If inserts then fail with permission denied for sequence, the table uses a serial id. Postgres’s privileges reference says USAGE on a sequence allows nextval, so grant usage on that sequence to the roles that insert rows.

Views and functions follow their own rules. Views need their own grants, and the securing-your-API page notes that new functions stay callable by every role because Postgres grants execute to PUBLIC globally. If an RLS policy calls a helper function, make sure the roles can execute it.

One shortcut to avoid: Supabase’s Data API settings still let you expose new tables automatically. Switching that back on makes the error disappear and brings back the old default, where every table your agent creates is open to the API before anyone has written a policy for it.

Stop your AI builder from repeating it

Fixing today’s table takes a minute. The next feature will create another table, and the agent will skip the grants again unless something tells it not to. Commenters in Supabase’s discussion of the change report the same pattern: AI-generated migrations often leave out GRANT statements. Supabase staff in that thread call explicit grants in migrations the durable approach.

So write it down where the agent reads it on every change:

  • Lovable: per Lovable’s instructions docs, it reads any AGENTS.md or CLAUDE.md file at the top level of your project with every message you send. Project settings also has an Instructions field, up to 10,000 characters.
  • Cursor: Cursor’s rules docs say it supports AGENTS.md in the project root, and project rules live in .cursor/rules as .mdc files. Set alwaysApply: true, or scope the rule with globs to your supabase/migrations folder.
  • Bolt and other builders: put the same text in whatever project prompt or instructions field the tool gives you, and keep a copy in AGENTS.md in the repo so it travels with the code.

The rule itself, ready to paste:

Supabase: every migration that creates a table in public must, in the same file,
1. grant only the needed privileges to anon, authenticated and service_role,
2. enable row level security,
3. create the policies the feature needs.
Never disable RLS or use the service role key in client code to fix a
permission error. "permission denied for table" means a missing grant.

Then check it held. After each feature, call the new table from the app as a logged-out visitor and as a signed-in user. One request each is enough to catch a missing grant before your users do.

Which fix fits your situation

What you seeCauseFix
permission denied for table on a table created after October 30No grantGrant per role, enable RLS, add policies
Same error after a restore, reset or recreated tableGrants didn’t survivePut grants in the migration that creates the table
Empty list, no errorGrant present, no matching policyWrite a SELECT policy for the right role
new row violates row-level security policyInsert blocked by RLSAdd or fix the INSERT policy’s check
permission denied for sequence on insertSerial id without sequence grantGrant usage on the sequence
The agent keeps breaking new tablesNo standing ruleAdd the rule to AGENTS.md or project rules

If more than two rows apply, the problem is the migration history, not one table. That’s usually the moment to have a developer read the whole schema once. Our migrating off Lovable Cloud guide covers checking grants table by table after a move between projects.

WordUp Tutoring: from one build to a retainer

We built WordUp Tutoring’s learning app on Next.js and Supabase: daily challenges, homework help, reading support and learning games for K-8 students, with sign-in by email or Google and a separate way in for students. After that first fixed-scope build, WordUp moved to a retainer, and our engineer has kept building the AI into the product since.

A product that keeps growing keeps adding tables, which is the exact spot this change bites. Every new feature on a live Supabase app is a new table, a new set of grants and a new set of policies, written together and reviewed together. On a codebase a person owns, that’s a habit. On one an agent writes, it has to be a rule.

When an AI-built app has already collected a few of these breaks, our Code Rescue engagement is where we fix them: grants, RLS and migrations on a Lovable, Bolt or Cursor codebase, so the next feature doesn’t undo the last one. It runs 2-4 weeks. Code Rescue starts at $6,000. If your app came from one of those builders, the fixes by tool page shows what we usually find in each.

Frequently asked questions

Why does Supabase say permission denied for table on a table I just created?
The table has no grants for the API roles. Since October 30, 2026, Supabase no longer grants new tables in the public schema to anon, authenticated and service_role on any project, so the Data API refuses every request with error 42501. Grant the privileges each role needs, enable row level security, and add your policies in the same migration.
Will disabling row level security fix Supabase error 42501?
No. Postgres checks table grants before row level security, so a request without a grant fails before any policy is read. Turning RLS off leaves the error in place and removes your row protection for the moment you do add the grant. Add the grant instead, and keep RLS enabled on every table the Data API can reach.
Are my existing Supabase tables affected by the October 30 grants change?
Supabase says no: tables that existed before the change keep their current grants and stay reachable through the Data API. The change applies to tables created after it. A table that is dropped and recreated, or rebuilt by a restore or a database reset, counts as new and needs its grants added again in the migration that creates it.
Why do I get permission denied for sequence after fixing the table?
The table uses a serial id, and inserting a row calls nextval on the sequence behind it. In Postgres, nextval needs the USAGE or UPDATE privilege on that sequence, which a table grant doesn't include. Grant usage on the sequence to the roles that insert rows, or use a uuid or identity primary key for new tables.
How do I stop Lovable or Cursor from creating Supabase tables without grants?
Put a rule in a project instructions file that the agent reads on every change. Lovable reads AGENTS.md or CLAUDE.md at the top of your project with every message, and Cursor reads AGENTS.md and .cursor/rules files. The rule should require grants, row level security and policies in the same migration as every new table.

References

  1. Supabase changelog - Tables not exposed to Data and GraphQL API automatically
  2. Supabase - Securing your API
  3. Supabase - Database API 42501 errors
  4. Supabase - Row Level Security
  5. Supabase GitHub discussion #45329 - tables not exposed automatically
  6. PostgreSQL - Privileges
  7. Lovable - Instructions and AGENTS.md
  8. Cursor - Rules

More from the journal

Hear from Khushi within 24 hours.

Khushi Arora Partner @ Zeroic

AI builder broke your Supabase app again? Code Rescue takes a Lovable, Bolt or Cursor app and fixes the grants, RLS and migrations underneath, so the next feature doesn't break the last one.

See Code Rescue, or book a 30-minute call