{"id":"9f413fd29f626c36","repo":"jackc/pgx","slug":"invalid-value-length-d-at-offset-d","errorCode":null,"errorMessage":"invalid value length %d at offset %d","messagePattern":"invalid value length (.+?) at offset (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pgio/read.go","lineNumber":189,"sourceCode":"\t}\n\treturn count\n}\n\n// Value reads an int32 length followed by that many bytes — the standard\n// PostgreSQL binary representation of a value. A length of -1 means NULL and\n// returns (nil, true). Any other negative length is an error. The returned\n// slice aliases the source; null is only meaningful if Err returns nil.\nfunc (r *Reader) Value() (data []byte, null bool) {\n\toffset := r.rp\n\tlength := r.Int32()\n\tif r.err != nil {\n\t\treturn nil, false\n\t}\n\tif length == -1 {\n\t\treturn nil, true\n\t}\n\tif length < 0 {\n\t\tr.fail(fmt.Errorf(\"invalid value length %d at offset %d\", length, offset))\n\t\treturn nil, false\n\t}\n\treturn r.Bytes(int(length)), false\n}\n\n// Finish returns the first error encountered, or an error if unread bytes\n// remain. Decoders that must consume the entire source should end with Finish.\nfunc (r *Reader) Finish() error {\n\tif r.err != nil {\n\t\treturn r.err\n\t}\n\tif r.rp != len(r.s) {\n\t\treturn r.errTrailing()\n\t}\n\treturn nil\n}\n\nfunc (r *Reader) errTrailing() error {","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/internal/pgio/read.go#L171-L207","documentation":"Error \"invalid value length %d at offset %d\" thrown in jackc/pgx.","triggerScenarios":"Thrown at internal/pgio/read.go:189 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}