Lovable error: "new row violates row-level security policy for table"
What it means
Supabase, the database Lovable uses, has a security lock that decides who can add or read data. Your app tried to save something, and the lock said no, usually because the user isn't logged in or no rule allows it.
How to fix it
- Make sure you're logged in to your app when you test it.
- In Lovable, ask: "Add a Supabase RLS policy so logged-in users can insert and read their own rows in the [table name] table, using auth.uid() = user_id."
- Check that the table has a
user_idcolumn and that your app fills it in when saving.
FAQ
How do I fix the Supabase row-level security error in Lovable?
Ask Lovable to add an RLS policy that lets logged-in users insert and read their own rows using auth.uid() = user_id. Then test while logged in.
What does "new row violates row-level security policy" mean?
Supabase blocked your app from saving data because no rule allows it for the current user.
Should I just turn off row-level security?
No. That exposes your data to anyone. Add a policy instead.
Still stuck? Paste the error into Unstuck and get a ready-to-paste Lovable prompt. Your first 3 fixes are free.
Get my fix prompt — 3 free