Supabase PGRST116: “JSON object requested, multiple (or no) rows returned”
Last verified: October 18, 2026
JSON object requested, multiple (or no) rows returned (PGRST116)
What it means
Your code used .single(), which tells Supabase the result must be exactly one row. It got zero (or more than one), so the API returns PGRST116 with HTTP 406. Newer versions word it as “Cannot coerce the result to a single JSON object” with details “The result contains 0 rows”. Zero rows usually means the row was never created (for example no profiles row for a new user) or an RLS policy hides it from this user.
How to fix it
- Read the error’s
details: “0 rows” means missing or hidden, “2 rows” (or more) means duplicates. - Check the row exists in Table Editor. If it exists, the SELECT policy probably doesn’t let this user see it. Check it’s scoped to
auth.uid()and the user is logged in. - If the row may legitimately not exist yet (first login, optional settings), use
.maybeSingle()and handledata === null. - If every user should have a row (like a profile), create it on sign-up (for example with a trigger on
auth.users) instead of hiding the error.
If your Lovable project uses Lovable Cloud instead of your own Supabase project, the same database lives under More → Cloud → Database. Its RLS view is read-only, so ask Lovable in chat (Plan mode) to make the policy change.
Stop the loop: paste these into Lovable
1. Diagnose first
Stop editing and don't retry earlier fixes. The app gets Supabase error PGRST116 ("JSON object requested, multiple (or no) rows returned" / "Cannot coerce the result to a single JSON object"). Without changing code: find the query that uses .single(), show me its filters, tell me how many rows match for the current user in the database, and list the SELECT RLS policies on that table. Then state in one sentence whether the row is missing, hidden by RLS, or duplicated, and propose ONE minimal change.2. Then the one fix
Apply only the change that matches the diagnosis. If the row can legitimately be absent, replace .single() with .maybeSingle() in that one query and handle a null result in the UI. If the row should always exist, create it when the user signs up instead of masking the error. If RLS hides it, add or fix a SELECT policy scoped to auth.uid() (keep RLS on). If there are duplicates, add the missing filter or a unique constraint. Then reload as a logged-in user and confirm the error is gone. Tell me exactly what changed.
3. Save this rule so it stays fixed
Lovable: Project settings → Knowledge. Cursor: .cursor/rules or .cursorrules. Bolt: Project settings → Knowledge. Replit: replit.md.
Rule: Only use .single() when exactly one row is guaranteed. Use .maybeSingle() when a row may not exist and handle null. Every user-owned table needs a SELECT policy scoped to auth.uid(). Check error.code (e.g. PGRST116), not the message text.
FAQ
Why do I see two different messages?
Different PostgREST versions word PGRST116 differently. The code PGRST116 is the same, so match on the code.
The row is right there in the dashboard. Why 0 rows?
The dashboard bypasses RLS. Your app doesn't. A missing or wrong SELECT policy makes the row invisible to the user, so the count is zero.
Sources
- PostgREST: Singular or Plural (PGRST116 response)
- PostgREST error codes (PGRST116 → 406)
- Supabase JS reference: maybeSingle()
Your error is a bit different? Paste it with what you already tried and get a diagnose-first prompt, one fix and a rule for your exact case.
Break the loop — 3 free fixes Still stuck? Get a human fix