Dev.to
7/14/2026

Fixing Supabase RLS insert errors: three causes and the correct policy
Original: Fix: "new row violates row-level security policy" in Supabase (it's not what you think)
Short summary
This post explains why the 'new row violates row-level security policy' error in Supabase is actually good news — RLS is working. It identifies three causes: no INSERT policy, mismatched user_id, or unauthenticated requests. The fix involves creating an INSERT policy with WITH CHECK and defaulting user_id server-side. Key gotchas include USING vs WITH CHECK semantics and testing through the app client rather than the SQL editor.
- •RLS error means security is working — don't disable it
- •Three causes: no INSERT policy, wrong user_id, or unauthenticated request
- •Fix: add INSERT policy with WITH CHECK and default user_id server-side
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



