# 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

1. If zero rows is a valid state, switch to `.maybeSingle()` and handle `null`.
2. Filter on a primary key or unique column.
3. 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.

> **Scan box (use the site's ScanBox component):** Check whether your live app has this problem. Paste your URL for a free outside-in scan covering exposed keys, open database rules, CORS and security headers. [Scan my app free →](https://proofforge.live/#scan)

## 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.

## Sources

- [PostgREST: Error codes](https://docs.postgrest.org/en/stable/references/errors.html)
- [Supabase JS: maybeSingle()](https://supabase.com/docs/reference/javascript/maybesingle)

## Related

- [Fix 'new row violates row-level security policy' (Supabase)](/errors/new-row-violates-row-level-security-policy)
- [Fix: RLS policy using (true)](/fix/supabase-rls-using-true)
- [Supabase RLS checker](/tools/supabase-rls-checker)
- [All errors](/errors)
