---
title: "Supabase permission denied for table on new tables | Zeroic"
description: "Supabase permission denied for table (42501) on a new table means it has no grants. Run three GRANTs, keep RLS on, and stop your AI builder repeating it."
url: https://zeroic.in/blog/supabase-permission-denied-table
---

[The Zeroic Journal](https://zeroic.in/blog)

[No-code](https://zeroic.in/blog/topic/no-code) November 16, 2026 7 min read

# 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.

By Khushi Arora Partner @ Zeroic

On this page

1. [Why Supabase permission denied for table appears](#why-supabase-permission-denied-for-table-appears)
2. [A missing grant fails loudly, RLS quietly](#a-missing-grant-fails-loudly-rls-quietly)
3. [The three-line fix for each table](#the-three-line-fix-for-each-table)
4. [Stop your AI builder from repeating it](#stop-your-ai-builder-from-repeating-it)
5. [Which fix fits your situation](#which-fix-fits-your-situation)
6. [WordUp Tutoring: from one build to a retainer](#wordup-tutoring-from-one-build-to-a-retainer)

On this page 6 sections

1. [Why Supabase permission denied for table appears](#why-supabase-permission-denied-for-table-appears)
2. [A missing grant fails loudly, RLS quietly](#a-missing-grant-fails-loudly-rls-quietly)
3. [The three-line fix for each table](#the-three-line-fix-for-each-table)
4. [Stop your AI builder from repeating it](#stop-your-ai-builder-from-repeating-it)
5. [Which fix fits your situation](#which-fix-fits-your-situation)
6. [WordUp Tutoring: from one build to a retainer](#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](https://supabase.com/changelog/45329-breaking-change-tables-not-exposed-to-data-and-graphql-api-automatically) 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](https://supabase.com/docs/guides/troubleshooting/database-api-42501-errors) 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](https://supabase.com/docs/guides/api/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](https://supabase.com/docs/guides/database/postgres/row-level-security) 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](https://zeroic.in/blog/supabase-row-level-security-not-working) 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](https://www.postgresql.org/docs/current/ddl-priv.html) 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](https://github.com/orgs/supabase/discussions/45329) 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](https://docs.lovable.dev/features/knowledge), 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](https://cursor.com/docs/context/rules) 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 policy`Insert 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](https://zeroic.in/blog/migrate-lovable-cloud-supabase) 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](https://zeroic.in/wordup-tutoring): 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](https://zeroic.in/services/code-rescue) 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](https://zeroic.in/code-rescue-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](https://supabase.com/changelog/45329-breaking-change-tables-not-exposed-to-data-and-graphql-api-automatically)
2. [Supabase - Securing your API](https://supabase.com/docs/guides/api/securing-your-api)
3. [Supabase - Database API 42501 errors](https://supabase.com/docs/guides/troubleshooting/database-api-42501-errors)
4. [Supabase - Row Level Security](https://supabase.com/docs/guides/database/postgres/row-level-security)
5. [Supabase GitHub discussion #45329 - tables not exposed automatically](https://github.com/orgs/supabase/discussions/45329)
6. [PostgreSQL - Privileges](https://www.postgresql.org/docs/current/ddl-priv.html)
7. [Lovable - Instructions and AGENTS.md](https://docs.lovable.dev/features/knowledge)
8. [Cursor - Rules](https://cursor.com/docs/context/rules)

#supabase#postgres#lovable#cursor#security

More from the journal

[ No-code

## [Lovable vs Bolt vs Cursor: which vibe-coded MVP survives to production (2026)](https://zeroic.in/blog/lovable-vs-bolt-vs-cursor)

What breaks first in apps built with Lovable, Bolt and Cursor, what each costs to fix, and how to pick the tool that fits your team.

Khushi Arora Sep 22, 2026 · 8 min read

[ Software engineering

## [Hiring a developer to fix Lovable app bugs: what to ask first](https://zeroic.in/blog/developer-fix-lovable-app)

Run Lovable's own scans, prepare five things for day one, and know which answers in a quote mean you should keep looking.

Khushi Arora Oct 30, 2026 · 7 min read

[ Software engineering

## [Lovable app security issues: an afternoon checklist](https://zeroic.in/blog/lovable-app-security-issues)

Lovable's built-in scan reports only critical findings. These are the six settings behind most leaks, and how to check each one yourself.

Khushi Arora Oct 14, 2026 · 8 min read

## 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](https://zeroic.in/services/code-rescue), or [book a 30-minute call](https://zeroic.in/book)

Pages [Services](https://zeroic.in/services) [Work](https://zeroic.in/work) [Blog](https://zeroic.in/blog) [About](https://zeroic.in/about) [Guide for AI](https://zeroic.in/llms.txt)

Services [Audits](https://zeroic.in/services/ai-audit) [MVP Sprint](https://zeroic.in/services/mvp-development) [Retainer](https://zeroic.in/services/senior-developers) [Code Rescue](https://zeroic.in/services/code-rescue) [AI development](https://zeroic.in/ai-development-company) [Fractional CTO](https://zeroic.in/fractional-cto-services)

Solutions [Fix AI-built apps](https://zeroic.in/code-rescue-by-tool) [AI services](https://zeroic.in/ai-services) [Migrations](https://zeroic.in/migrations) [Bubble to code](https://zeroic.in/bubble-to-code) [Build an app like](https://zeroic.in/build-an-app-like)

Industries [Marketplaces](https://zeroic.in/marketplace-app-development) [B2B SaaS](https://zeroic.in/saas-mvp-development) [FinTech](https://zeroic.in/fintech-app-development) [Telehealth](https://zeroic.in/telehealth-app-development) [EdTech](https://zeroic.in/edtech-app-development) [All industries →](https://zeroic.in/industries)

Developers [Bubble](https://zeroic.in/hire-bubble-developers) [React](https://zeroic.in/hire-react-developers) [Python](https://zeroic.in/hire-python-developers) [AI & LLMs](https://zeroic.in/hire-ai-developers) [API integrations](https://zeroic.in/api-integration-services) [All developers →](https://zeroic.in/developers)

Contact [Email](mailto:zeroic.in@gmail.com) [WhatsApp](https://wa.me/919873927225) [LinkedIn](https://www.linkedin.com/company/zeroic/) [X (Twitter)](https://x.com/PrashantAbbi) [Book a call](https://zeroic.in/book)

© 2026 Zeroic [Privacy](https://zeroic.in/privacy) [Terms](https://zeroic.in/terms)

Built in India · Shipping globally

SINCE
