TL;DR. Our Supabase upsert wrote the row. The chained .select().single() returned PGRST116. The wrapper read that as a failed write. The frontend retried. The retry was wrong. Two days to find why. We've been running an LMS on Supabase for the past several months — auth, RLS on every table, FastAPI talking to Postgres. The bug below cost us two days last quarter, and the fix changed how we read PGRST116 in our wrapper. The setting We have a quiz_attempts table. Each attempt gets created on quiz start, updated as the student progresses. The update is an upsert because a retry of the same attempt_id should patch the existing row, not insert a duplicate. const { data , error } = await supabase . from ( ' quiz_attempts ' ) . upsert ({ id , student_id , quiz_id , attempt_count }) . select () . single (); Enter fullscreen mode Exit fullscreen mode The .select().single() chain returns the upserted row so we can show the student their new state.…