VIBE⌇BRATOR
Take the Vibe Check
Error explained

Supabase row-level security

new row violates row-level security policy for table "…"

Row-level security is on for the table, and none of its policies allowed this insert or update.

Before you start: is Supabase itself down?

The short answer

Supabase refused to save the row because a security rule on the table did not allow it. That rule is called row-level security, and it is doing its job: nothing is down.

Usually the rule is missing, the request is not signed in, or the row’s owner column does not match the person who is signed in. The fix is a rule that allows exactly this case. Switching the security off makes the error go away by letting everyone through.

What it means

With row-level security (RLS) switched on, Postgres checks every new or changed row against the table's policies. For an insert, the with check part of a policy decides; if no policy lets the row through, the whole statement is rejected with this error. Supabase's guide gives its error code as 42501.

The error comes from your table's policies, not from an outage.

Common causes

A worked example

This example is made up for this page and built only from the Supabase and PostgreSQL documentation listed under Sources. It is not a story about a real app. A signed-in user saves a note, and the code asks for the saved row back:

await supabase.from('notes').insert({ body: 'Buy lemons', user_id: user.id }).select()

The table has one policy, for inserts: to authenticated, with check (auth.uid() = user_id). The insert passes that check. But .select() asks for the new row back, and Postgres only hands back rows that pass a SELECT policy. There is none, so the whole statement fails with this error, even though the insert rule was right. That is the fourth cause above.

The fix is a second policy, for select, with using (auth.uid() = user_id), so people can read back their own rows and nobody else’s. Or drop the .select() if the code does not need the row back.

Ways to fix it

A prompt to fix it

Paste it into your AI coding tool and fill in the parts in angle brackets. It asks the tool to find the cause and show you before it changes anything.

Paste it, then fill in the <angle brackets>
My Supabase insert fails with: new row violates row-level security policy for table "<table>".

Here is the code that does the insert:
<paste it>

Before writing any policy, show me:
1. The current policies on this table (select * from pg_policies where tablename = '<table>').
2. Whether the request is signed in when it runs, and what auth.uid() would be.
3. The exact row being inserted, including the column the policy checks (for example user_id).
4. Whether the insert is followed by .select(), which also needs a SELECT policy.

Then write the smallest policy that allows only this: signed-in users inserting rows whose owner column equals auth.uid(). Use to authenticated and with check. If the code reads the row back, add a matching SELECT policy.

Do not disable RLS. Do not use the service role or secret key in browser code.

How to check it is fixed

What this page does not cover

Tested prompts that help

Where to go next

Sources

Everything above comes from these pages. We read them on September 27, 2026; if one has changed since, it wins.