A list, dashboard, or file upload fails. The browser may show a generic 500 or an empty state. In the API response or Postgres logs you see:
ERROR: 42P17: infinite recursion detected in policy for relation "profiles"
Enter fullscreen mode
Exit fullscreen mode
The relation name is the looping table: profiles , list_members , organization_members . This is not a missing policy (that is 42501 / "new row violates row-level security policy") and not a policy that is too open.
How the loop starts
A policy runs for every row a role reads or writes. If it queries a table that also has RLS, those policies run too. Two shapes show up a lot in Lovable and Bolt apps with teams or admins:
A table looks at itself. A policy on profiles says "you may read every profile if your own profile has is_admin = true ". To decide that, Postgres reads profiles and hits the same policy again.
Two tables look at each other. A policy on lists allows a row if you appear in list_members .…