{"record":{"id":"01d125a406391c1b","repo":"jackc/pgx","slug":"unknown-format-code","errorCode":null,"errorMessage":"unknown format code","messagePattern":"unknown format code","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rows.go","lineNumber":323,"sourceCode":"\t\t\tcontinue\n\t\t}\n\n\t\tif dt, ok := rows.typeMap.TypeForOID(fd.DataTypeOID); ok {\n\t\t\tvalue, err := dt.Codec.DecodeValue(rows.typeMap, fd.DataTypeOID, fd.Format, buf)\n\t\t\tif err != nil {\n\t\t\t\trows.fatal(err)\n\t\t\t}\n\t\t\tvalues = append(values, value)\n\t\t} else {\n\t\t\tswitch fd.Format {\n\t\t\tcase TextFormatCode:\n\t\t\t\tvalues = append(values, string(buf))\n\t\t\tcase BinaryFormatCode:\n\t\t\t\tnewBuf := make([]byte, len(buf))\n\t\t\t\tcopy(newBuf, buf)\n\t\t\t\tvalues = append(values, newBuf)\n\t\t\tdefault:\n\t\t\t\trows.fatal(errors.New(\"unknown format code\"))\n\t\t\t}\n\t\t}\n\n\t\tif rows.Err() != nil {\n\t\t\treturn nil, rows.Err()\n\t\t}\n\t}\n\n\treturn values, rows.Err()\n}\n\nfunc (rows *baseRows) RawValues() [][]byte {\n\treturn rows.values\n}\n\nfunc (rows *baseRows) Conn() *Conn {\n\treturn rows.conn\n}","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/rows.go#L305-L341","documentation":"Values() fallback guard: a column's OID has no registered type in the connection's type map and the field's format code is neither text (0) nor binary (1), so the raw bytes cannot even be guessed at. The unrecognized format code in the RowDescription is the faulty input — PostgreSQL itself only ever sends 0 or 1.","triggerScenarios":"Thrown at rows.go:323 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check for a corrupted or non-PostgreSQL stream","Verify custom proxy/protocol middleware isn't rewriting field format codes"],"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"}