{"id":"a502f881bf2d2af7","repo":"jackc/pgx","slug":"invalid-byte-count-d-at-offset-d","errorCode":null,"errorMessage":"invalid byte count %d at offset %d","messagePattern":"invalid byte count (.+?) at offset (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pgio/read.go","lineNumber":122,"sourceCode":"\nfunc (r *Reader) Uint64() uint64 {\n\tif !r.need(8) {\n\t\treturn 0\n\t}\n\tn := binary.BigEndian.Uint64(r.s[r.rp:])\n\tr.rp += 8\n\treturn n\n}\n\nfunc (r *Reader) Int64() int64 {\n\treturn int64(r.Uint64())\n}\n\n// Bytes reads the next n bytes. The returned slice aliases the source; it is\n// not a copy.\nfunc (r *Reader) Bytes(n int) []byte {\n\tif n < 0 {\n\t\tr.fail(fmt.Errorf(\"invalid byte count %d at offset %d\", n, r.rp))\n\t\treturn nil\n\t}\n\tif !r.need(n) {\n\t\treturn nil\n\t}\n\tb := r.s[r.rp : r.rp+n]\n\tr.rp += n\n\treturn b\n}\n\n// CString reads a NUL-terminated string, returning the bytes before the\n// terminator and consuming the terminator. The returned slice aliases the\n// source; it is not a copy.\nfunc (r *Reader) CString() []byte {\n\tif r.err != nil {\n\t\treturn nil\n\t}\n\ti := bytes.IndexByte(r.s[r.rp:], 0)","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/internal/pgio/read.go#L104-L140","documentation":"Error \"invalid byte count %d at offset %d\" thrown in jackc/pgx.","triggerScenarios":"Thrown at internal/pgio/read.go:122 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}