{"record":{"id":"579c0d26a85370c8","repo":"jackc/pgx","slug":"unknown-jsonb-version-number-d","errorCode":null,"errorMessage":"unknown jsonb version number %d","messagePattern":"unknown jsonb version number (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/jsonb.go","lineNumber":72,"sourceCode":"\n\treturn nil\n}\n\ntype scanPlanJSONBCodecBinaryUnwrapper struct {\n\ttextPlan ScanPlan\n}\n\nfunc (plan *scanPlanJSONBCodecBinaryUnwrapper) Scan(src []byte, dst any) error {\n\tif src == nil {\n\t\treturn plan.textPlan.Scan(src, dst)\n\t}\n\n\tif len(src) == 0 {\n\t\treturn fmt.Errorf(\"jsonb too short\")\n\t}\n\n\tif src[0] != 1 {\n\t\treturn fmt.Errorf(\"unknown jsonb version number %d\", src[0])\n\t}\n\n\treturn plan.textPlan.Scan(src[1:], dst)\n}\n\nfunc (c *JSONBCodec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error) {\n\tif src == nil {\n\t\treturn nil, nil\n\t}\n\n\tswitch format {\n\tcase BinaryFormatCode:\n\t\tif len(src) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"jsonb too short\")\n\t\t}\n\n\t\tif src[0] != 1 {\n\t\t\treturn nil, fmt.Errorf(\"unknown jsonb version number %d\", src[0])","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/jsonb.go#L54-L90","documentation":"PostgreSQL's binary jsonb wire format starts with a version byte that must currently be 1. This guard fires when that leading byte holds any other value, meaning the payload either is not binary jsonb or comes from an incompatible/unknown future version of the format.","triggerScenarios":"Thrown at pgtype/jsonb.go:72 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the column type is jsonb and the value was not mangled in transit","Use text format for jsonb columns if interoperability with the server's binary encoding is broken","Upgrade pgx to a version matching the server's PostgreSQL release"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}