{"id":"54c58aa917d93123","repo":"jackc/pgx","slug":"message-body-too-large","errorCode":null,"errorMessage":"message body too large","messagePattern":"message body too large","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgproto3/pgproto3.go","lineNumber":116,"sourceCode":"\t}\n\treturn nil, errors.New(\"unknown protocol representation\")\n}\n\n// beginMessage begins a new message of type t. It appends the message type and a placeholder for the message length to\n// dst. It returns the new buffer and the position of the message length placeholder.\nfunc beginMessage(dst []byte, t byte) ([]byte, int) {\n\tdst = append(dst, t)\n\tsp := len(dst)\n\tdst = pgio.AppendInt32(dst, -1)\n\treturn dst, sp\n}\n\n// finishMessage finishes a message that was started with beginMessage. It computes the message length and writes it to\n// dst[sp]. If the message length is too large it returns an error. Otherwise it returns the final message buffer.\nfunc finishMessage(dst []byte, sp int) ([]byte, error) {\n\tmessageBodyLen := len(dst[sp:])\n\tif messageBodyLen > maxMessageBodyLen {\n\t\treturn nil, errors.New(\"message body too large\")\n\t}\n\tpgio.SetInt32(dst[sp:], int32(messageBodyLen))\n\treturn dst, nil\n}\n","sourceCodeStart":98,"sourceCodeEnd":121,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgproto3/pgproto3.go#L98-L121","documentation":"Error \"message body too large\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgproto3/pgproto3.go:116 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}