{"record":{"id":"944cf47722a7b461","repo":"jackc/pgx","slug":"hstore-pair-d-w","errorCode":null,"errorMessage":"hstore pair %d: %w","messagePattern":"hstore pair (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/hstore.go","lineNumber":205,"sourceCode":"\n\tr := pgio.NewReader(src)\n\n\t// Each pair carries at minimum two int32 length headers (key, value). This bounds the\n\t// up-front make() against a malicious server claiming a huge pair count in a small message.\n\tpairCount := r.Count(8)\n\tif err := r.Err(); err != nil {\n\t\treturn fmt.Errorf(\"hstore: %w\", err)\n\t}\n\n\thstore := make(Hstore, pairCount)\n\t// one allocation for all *string, rather than one per string, just like text parsing\n\tvalueStrings := make([]string, pairCount)\n\n\tfor i := range pairCount {\n\t\tkeyBytes, keyNull := r.Value()\n\t\tvalueBytes, valueNull := r.Value()\n\t\tif err := r.Err(); err != nil {\n\t\t\treturn fmt.Errorf(\"hstore pair %d: %w\", i, err)\n\t\t}\n\t\tif keyNull {\n\t\t\treturn fmt.Errorf(\"hstore pair %d: key cannot be NULL\", i)\n\t\t}\n\n\t\tkey := string(keyBytes)\n\t\tif valueNull {\n\t\t\thstore[key] = nil\n\t\t} else {\n\t\t\tvalueStrings[i] = string(valueBytes)\n\t\t\thstore[key] = &valueStrings[i]\n\t\t}\n\t}\n\n\tif err := r.Finish(); err != nil {\n\t\treturn fmt.Errorf(\"hstore: %w\", err)\n\t}\n\treturn scanner.ScanHstore(hstore)","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/hstore.go#L187-L223","documentation":"While parsing a binary hstore, reading the key/value pair at index %d failed (length header or data read error, wrapped with %w from the pgio reader). The malformed binary hstore payload from the server is at fault.","triggerScenarios":"Thrown at pgtype/hstore.go:205 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error for the precise read failure","Treat the wire data as corrupted and re-fetch the row"],"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"}