{"id":"7cc6419c1d938dc4","repo":"jackc/pgx","slug":"unknown-protocol-representation","errorCode":null,"errorMessage":"unknown protocol representation","messagePattern":"unknown protocol representation","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgproto3/pgproto3.go","lineNumber":99,"sourceCode":"\tActualBodyLen      int\n}\n\nfunc (e *ExceededMaxBodyLenErr) Error() string {\n\treturn fmt.Sprintf(\"invalid body length: expected at most %d, but got %d\", e.MaxExpectedBodyLen, e.ActualBodyLen)\n}\n\n// getValueFromJSON gets the value from a protocol message representation in JSON.\nfunc getValueFromJSON(v map[string]string) ([]byte, error) {\n\tif v == nil {\n\t\treturn nil, nil\n\t}\n\tif text, ok := v[\"text\"]; ok {\n\t\treturn []byte(text), nil\n\t}\n\tif binary, ok := v[\"binary\"]; ok {\n\t\treturn hex.DecodeString(binary)\n\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}","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgproto3/pgproto3.go#L81-L117","documentation":"Error \"unknown protocol representation\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgproto3/pgproto3.go:99 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}