Guide
Edits or upserts blocked by row-level security
Updated
Saving a new item works, but editing one fails with a row-level security error, or the save looks fine and the row is unchanged.
Why it happens
Supabase's own docs say an update needs a matching read rule on the same table. An upsert that updates an existing row runs into the same requirement.
Possible causes
- The table has a rule for updating but no rule for reading the same rows, so the update does not work as expected.
- An upsert is doing its update half and has no read rule behind it.
- A missing grant on the table is refused with the same error code before any rule runs.
- The new values break the rule's check, which is about the values in the row, not about visibility.
- The rule filters the row out, so the update matches zero rows and raises nothing, while the row stays unchanged.
You can't see it yourself
You're signed in, your customers aren't. A save that looks fine can still be a failure. Only reloading as the owner, and checking from a second account, shows what actually happened.
Related: Data won't save: "new row violates row-level security policy" · Supabase "permission denied for table" (42501) · Users can see other users' data in my Lovable app
VibeFix is independent. Lovable, Bolt, Replit, Base44, v0, Supabase, Firebase, Stripe and Vercel are trademarks of their owners.
Want it fixed?
Our AI agent finds the cause, fixes it in your code and re-checks your live app. $79 for one bug, paid up front. If we can't complete your re-check, you get your money back.
It starts with a free check that confirms the problem on your live app, no account needed.