Supabase 'New Row Violates Row-Level Security Policy' Error
Workaround available Web, server (all SDKs) Updated October 21, 2026
Quick answer
RLS is on but no policy allows the write. Add an INSERT (or UPDATE) policy with a WITH CHECK that matches the row, plus a SELECT policy if you return the inserted row.
Most likely fix: Add an INSERT policy.
Symptoms
Insert or update fails with 'new row violates row-level security policy for table ...' (code 42501), or queries return empty arrays even though data exists.
Why it happens
- Only a SELECT policy exists - writes need their own INSERT/UPDATE policy
- Request is anonymous so auth.uid() is null
- Row payload doesn't include the column the policy checks (e.g. user_id)
- .insert().select() needs a SELECT policy to return the row
- Storage upload with upsert needs UPDATE policy too
How to fix it
Try these in order — the most common fix is first.
1. Add an INSERT policy
- Dashboard > Authentication > Policies > select table
- New policy > For INSERT, target role authenticated
- WITH CHECK: auth.uid() = user_id
2. Make sure the user is signed in
- Check supabase.auth.getUser() returns a user before writing
- Server-side, create the client with the user's session cookies, not the anon key alone
3. Send the column the policy checks
- Include user_id in the insert payload or set a default of auth.uid() on the column
4. Add a SELECT policy for returned rows
- If you call .insert().select() or .upsert(), add a SELECT policy allowing the user to read their own rows
5. Test as the real role
- SQL Editor runs as postgres and bypasses RLS
- Use the role switcher in the SQL editor to impersonate an authenticated user
This guide also covers
- new row violates row-level security policy supabase
- supabase rls not working
- supabase insert rls error
- supabase 42501
Still not working?
If Supabase keeps failing, you're not alone. See every Supabase problem users report or the alternatives people switch to.
Other Supabase errors
- Supabase Project Paused
- Supabase Max Client Connections Reached
- Supabase Confirmation Email Not Sending
- Supabase Auth Redirects to Localhost
- Supabase 'Invalid Refresh Token: Refresh Token Not Found'
- Supabase Edge Function 546 WORKER_LIMIT Error
- Supabase Storage Upload Failed
- Supabase 'Canceling Statement Due to Statement Timeout'
- Supabase Realtime Not Working
- Supabase Database Connection 'Network Is Unreachable'
- Supabase Start Not Working (Docker Container Unhealthy)