{"id":"b4418eac3e6c037c","repo":"jackc/pgx","slug":"invalid-hex-format","errorCode":null,"errorMessage":"invalid hex format","messagePattern":"invalid hex format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/bytea.go","lineNumber":227,"sourceCode":"\ntype scanPlanTextByteaToBytesScanner struct{}\n\nfunc (scanPlanTextByteaToBytesScanner) Scan(src []byte, dst any) error {\n\tscanner := (dst).(BytesScanner)\n\tbuf, err := decodeHexBytea(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn scanner.ScanBytes(buf)\n}\n\nfunc decodeHexBytea(src []byte) ([]byte, error) {\n\tif src == nil {\n\t\treturn nil, nil\n\t}\n\n\tif len(src) < 2 || src[0] != '\\\\' || src[1] != 'x' {\n\t\treturn nil, fmt.Errorf(\"invalid hex format\")\n\t}\n\n\tbuf := make([]byte, (len(src)-2)/2)\n\t_, err := hex.Decode(buf, src[2:])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf, nil\n}\n\nfunc (c ByteaCodec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error) {\n\treturn c.DecodeValue(m, oid, format, src)\n}\n\nfunc (c ByteaCodec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error) {\n\tif src == nil {\n\t\treturn nil, nil","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/bytea.go#L209-L245","documentation":"Error \"invalid hex format\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/bytea.go:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}