new row violates row-level security policy for table

Saving data fails with "new row violates row-level security policy"? Add an INSERT policy with a WITH CHECK rule and send the right user_id.

Reviewed October 14, 2026

What it means in plain English

Supabase refused to save a new or updated row because your security rules (RLS) don't allow that user to create it.

Likely causes

  • No INSERT (or UPDATE) policy exists on the table.
  • The policy's with check requires user_id = auth.uid() but your app doesn't send user_id, or sends a different value.
  • The user isn't signed in, so auth.uid() is null.
  • An UPDATE has no matching SELECT policy; Supabase notes UPDATE needs a SELECT policy to work.

How to fix it, step by step

  1. Supabase → Database → Policies, find the table.
  2. Add an INSERT policy, e.g.:
create policy "Users can create their own rows"
on public.todos for insert
to authenticated
with check ( (select auth.uid()) = user_id );
  1. For edits, add both an UPDATE policy (using + with check) and a SELECT policy.
  2. Make the app set user_id to the signed-in user's id when inserting (or give the column a default of auth.uid()).
  3. Confirm the user is signed in before saving.
  4. If uploading files, see the separate Supabase Storage page: Storage uses its own storage.objects policies.

How to check it worked

  • Submit the form again; the row should save and appear in Table Editor.
  • Try saving while signed out; it should still be refused.

Sources

Can't fix it? Get help.

If the steps didn't clear the error, send what the screen says. A person can take a look. This is a request for a paid fix, not an instant chat.

Request a fix