What does PGRST116 'Cannot coerce the result to a single JSON object' mean?
Short answer
You asked for exactly one row (.single()), but the query returned zero or more than one, so PostgREST answers 406 with PGRST116. Use .maybeSingle() when 'no row' is normal, and filter on a unique column. If the row exists but isn't returned, an RLS policy is hiding it.
Last updated 2026-11-25 · Reviewed by ProofForge
The exact error
text
{"code":"PGRST116","message":"Cannot coerce the result to a single JSON object","details":"The result contains 0 rows","hint":null}
(older PostgREST: "JSON object requested, multiple (or no) rows returned")Why it happens
- The filter matched no rows: wrong id, row not created yet, or RLS hides it from this user.
- The filter matched several rows because the column isn't unique.
.insert(...).select().single()where the SELECT policy doesn't allow reading the new row.
How to fix it
- If zero rows is a valid state, switch to
.maybeSingle()and handlenull. - Filter on a primary key or unique column.
- If the row is in the table but not returned, add a SELECT policy for the owner, not
using (true).
ts
const { data, error } = await supabase
.from('profiles')
.select('*')
.eq('id', user.id)
.maybeSingle() // null instead of PGRST116 when no row
if (!data) { /* create the profile or show onboarding */ }Check it's fixed
Test as a brand-new user (no row) and an existing user. Neither should throw PGRST116.
Check your live app
A free, read-only public-surface scan. It cannot diagnose private sessions or every cause described above.
FAQ
Why does it say 0 rows when I can see the row in the dashboard?
The dashboard bypasses RLS. Your app's role can't see the row, so add an owner-scoped SELECT policy.
Is PGRST116 a security issue?
No, but the 'fix' of making the SELECT policy using (true) would be. Then every user could read every row.
What HTTP status is it?
406 Not Acceptable.