#2 most commondatabaseLovableBolt.newCursorReplitv0Windsurf

new row violates row-level security policy for table

new row violates row-level security policy for table "profiles" (code 42501, 403 Forbidden)

Got a slightly different error? Paste the exact message and get a fix prompt tailored to it.

Paste your error →

What it means

Your database has a security guard (Row Level Security) that checks every save. There's no rule allowing this user to add or change this row, so the guard blocks it.

How to fix it: paste this prompt into your AI builder

Fix prompt for Lovable, Bolt, Cursor, Replit, v0, Windsurf
Supabase blocks my insert/update with "new row violates row-level security policy". For the table in the error, show me its current RLS policies, then add the minimal correct policies: an INSERT policy for authenticated users WITH CHECK (auth.uid() = user_id), plus a matching SELECT policy if the code reads the row back (.select() after insert), and UPDATE if needed. Make sure the insert sets user_id (or give the column a default of auth.uid()) and that the request is made while logged in. Do NOT disable RLS and do not use the service_role key in the browser. Give me the SQL as a migration.

If the AI can't fix it: manual steps

  1. Supabase dashboard, Authentication, Policies: check the table has a policy for the action (INSERT/UPDATE) you're doing.
  2. If it's a file upload, the policies needed are on storage.objects for that bucket.

Where this happens

Seen in these AI app builders and editors:

LovableBolt.newCursorReplitv0Windsurf

Sources

Related database errors

Still stuck? Paste your full error and UnstuckMyVibe will match it and hand you the exact fix prompt.

Fix my error →