Break of the day
Cataloged November 30, 2026
Supabase .single() fails with "JSON object requested, multiple (or no) rows returned" (PGRST116)
This applies when a supabase-js .single() call fails with code PGRST116 and HTTP 406 Not Acceptable. If this project does not use supabase-js, this card does not apply. Supabase is the platform tag because the failure is that .single() call. The pages on this card describe .single() and row level security. They do not describe a bug in one generator, so the same failure happens on any app that uses supabase-js, including an app an AI coding tool generated. The same error is also seen in Lovable, Bolt, Cursor, and v0 apps that use supabase-js. This card does not say Lovable, Bolt, Cursor, or v0 write that call. A typical call is supabase.from('profiles').select('*').eq('id', userId).single(). It works with row level security off, fails once row level security is on, or works in the SQL editor and fails in the app. The error object for the older wording, which is still widely googled, is { code: 'PGRST116', details: 'The result contains 0 rows', message: 'JSON object requested, multiple (or no) rows returned' }, and that wording is HTTP 406 Not Acceptable. The current PostgREST message for the same code is "Cannot coerce the result to a single JSON object", with details "The result contains 0 rows" or N rows. The PostgREST errors page lists PGRST116 as 406, "More than 1 or no items where returned when requesting a singular response". The resource representation docs say a singular response with no entries is 406 and code PGRST116, and they print "Cannot coerce the result to a single JSON object" with details "The result contains 0 rows". The PostgREST source sets the SingularityError message to "Cannot coerce the result to a single JSON object". The supabase-js single page says: "Query result must be one row (e.g. using .limit(1)), otherwise this returns an error." Supabase's PostgREST error codes page lists PGRST116 as 406. Stack Overflow question 72654424 shows that older message and "Results contain 0 rows" after enabling row level security. Its accepted resolution is that the server-side request did not carry the user's JWT. The longer guide linked from this page is "Lovable Supabase data exposed: check RLS on your own app".
Supabase