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 checkrequiresuser_id = auth.uid()but your app doesn't senduser_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
- Supabase → Database → Policies, find the table.
- 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 );
- For edits, add both an UPDATE policy (
using+with check) and a SELECT policy. - Make the app set
user_idto the signed-in user's id when inserting (or give the column a default ofauth.uid()). - Confirm the user is signed in before saving.
- If uploading files, see the separate Supabase Storage page: Storage uses its own
storage.objectspolicies.
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
Related fixes
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.