Guide · Supabase
Supabase says “permission denied for table”. What changed, and the safe fix.
It means your app asked Supabase for a table and Supabase refused, because that table was never opened to your app. Nothing leaked: your data is safe and still there. Since 30 October 2026 every new table in a Supabase project starts closed like this. The fix is to open it to the people who should use it, and not to everyone.
What does “permission denied for table” mean?
A Supabase table has two locks. The first decides whether your app may use the table at all; in database words this is a grant. The second, row level security, decides which rows each person may see once inside; that is a policy. This error is the first lock. Supabase answers with code 42501 and a message like this one:
"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 table’s name is in the message. The last word of the hint says who was turned away: anon means a visitor who is not signed in, and authenticated means a signed in user.
Why did this start happening?
Supabase changed its default. Until this year, every new table was opened to your app the moment it was made, so if nobody switched row level security on, any visitor could read it. New projects stopped doing that on 30 May 2026, and on 30 October 2026 the change reached every project. Tables you already had keep working. A table added since then, by you or by your AI tool, starts closed until someone opens it.
So this error is usually Supabase protecting you, and it most often shows up on the newest table in your app.
The fix that makes it worse
Your AI tool may suggest opening the table to every role, switching row level security off, or putting the secret service role key in your app. All three make the error go away. If row level security is off when the table is opened, the whole table becomes readable and changeable by anyone with your project’s address, which is Supabase’s most serious warning, “RLS disabled in public”. Open the table only to the people who should use it, and keep the second lock on.
How do I fix it?
1. Find the table and who was turned away
Both are in the error: the table’s name in the message, and anon or authenticated at the end of the hint.
2. Decide who should get in
- Something about a person (profiles, orders, messages, bookings): signed in users only, each seeing their own rows.
- Something on your public pages (products, a menu, blog posts): anyone may read, nobody else may change.
- Something only your own server uses (logs, settings): leave it closed to the app.
3. Ask the tool that built your app to fix it
Paste this into Claude, Lovable, Bolt, Cursor or any other AI tool you used:
My app gets “permission denied for table” from Supabase. Fix it for that table only. First make sure row level security is turned on for it. Then grant each role only what it needs: signed in users (authenticated) get the access the app uses, and visitors who are not signed in (anon) get read access only if the table is meant to be public, such as a product list. Add a policy so signed in users can read and change only their own rows. Do not grant anything to anon on tables about people, do not turn row level security off, and do not use the service role key in the browser. When you are done, list the table, each grant and each policy you added.
4. Or do it yourself in Supabase
In the SQL Editor, with your table’s name in place of your_table. These grants are Supabase’s own examples. Switch the second lock on first:
alter table public.your_table enable row level security;
-- Signed in users (still limited by your policies)
grant select, insert, update, delete on table public.your_table to authenticated;
-- Your own server code
grant select, insert, update, delete on table public.your_table to service_role;
-- Only if visitors who are not signed in should read it
grant select on table public.your_table to anon;Then add a policy for who may see which rows. Our guide to “RLS enabled no policy” has Supabase’s examples for a public table and for a table where each person sees only their own rows.
5. If something else appears next
- The list is now empty, with no error: the table is open but has no policy yet. That is “RLS enabled no policy”.
- “new row violates row-level security policy”: the first lock is now open and a policy is refusing that row. Ask your AI tool to fix the policy, not to remove it.
- “permission denied for sequence” when adding a row: the counter that numbers new rows needs the same permission as its table. Ask your AI tool to grant it for that table only.
6. Check you opened only what you meant to
Reload your app: the data should be back. Then check from the outside, the way a stranger would. Our free database check finds your app’s public key the way a visitor’s browser does and shows which tables a stranger can read, so you can see that the product list is open and the customer list is not.
Permission denied for schema public: what it means
A schema is a folder of tables, and public is the one your app uses. This error is one step before the table error: your app is refused the whole folder, usually because a migration or a tool removed its access. The safe fix opens the folder only, not the tables in it. Supabase’s guide to schemas grants it like this:
grant usage on schema public to anon, authenticated, service_role;Then open each table on its own, as in the steps above, and never grant everything on every table to make the error go away.
Permission denied for schema auth: why you should not fix it
The auth folder holds your users’ sign in details, and Supabase keeps it closed on purpose. In its own words, it restricts access “to prevent unintended custom changes” that “could break the functionality of the Auth service”. So this error means Supabase is working as it should. Granting access to auth does not work on hosted Supabase anyway. If your app needs something about the signed in user, ask your AI tool to read it through a small function in a folder you control, as Supabase recommends, or to keep the details you need in your own profiles table.
Permission denied to set role: what it means
Your app or a migration tried to act as one of Supabase’s own internal accounts, such as supabase_admin or supabase_auth_admin. Supabase keeps those for itself: only it can hand them out, so the request is refused. It usually comes from a migration file or a tool your AI added. Ask your AI tool to remove any line that switches to or grants those roles, and to do the work as the normal postgres role instead.
GuardCue checks apps built with AI tools and explains what it finds in plain English, for the person who built it rather than for a developer. Check your database, free.