You run a query from your app and Supabase answers:
{ "code" : "42501" , "message" : "permission denied for table todos" }
Enter fullscreen mode
Exit fullscreen mode
This is not the same error as "new row violates row-level security policy". Knowing the difference saves an hour, and the wrong fix can open your whole database.
What 42501 "permission denied for table" means
Postgres has two separate gates:
Table privileges (GRANT). Can this database role touch this table at all?
Row-level security (RLS policies). Which rows can that role see or change?
permission denied for table comes from gate 1. The role your request runs as ( anon for a logged-out visitor, authenticated for a signed-in user) has no GRANT on the table. RLS policies are never even reached.
"new row violates row-level security policy" comes from gate 2. The role has the privilege, but no policy allows that row.
The 4 usual causes
The table was created with SQL, not the dashboard.…