SQLSTATE 2203FSeverity lowLab verified

Incident brief

JSON_VALUE must return a single scalar

JSON_VALUE must resolve to a single scalar; a path that returns an array, object, or multiple items raises this data exception, use JSON_QUERY for non-scalars.

What lands in your log

ERROR: JSON path expression in JSON_VALUE must return single scalar item

Reproduced on PostgreSQL 18.4Verified 2026-07-24 (isolated lab, PostgreSQL 18.4)Verified against PostgreSQL 18.4 in an isolated lab environment

In 10 seconds

What triggers it
Call JSON_VALUE(doc, path) where the path returns an array, object, or multiple items rather than one scalar.
Fix
Point the path at a single scalar (an element like $[0] rather than the whole array).
Proof
Reproduced on PostgreSQL 18.4 → A single SELECT reproduces SQLSTATE 2203F; a non-scalar path result is rejected by JSON_VALUE.

Fix

What to do right now

Application-level steps for this error.

  • Point the path at a single scalar (an element like $[0] rather than the whole array).
  • Use JSON_QUERY instead of JSON_VALUE when you intend to return an array or object.
Fix SQL
-- PostgreSQL 17+: address one scalar item.
SELECT JSON_VALUE('[1,2]'::jsonb, '$[0]' RETURNING int ERROR ON ERROR) AS one_value;

Connected

Everything this error touches

Every page this SQLSTATE connects to: the concept that explains it, the runbooks that fix it, the parameters you tune to prevent it, and the sibling errors it travels with. All real cross-references. Jump straight in, or open the full interactive map.

Open in the interactive map →

Verification

PG 18.4
Last verified
2026-07-24 (isolated lab, PostgreSQL 18.4)
Verification scope
Verified against PostgreSQL 18.4 in an isolated lab environment
Audit status
reviewed
ShareLinkedInX

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops