{"record":{"id":"fe8961eed69851f6","repo":"jackc/pgx","slug":"too-many-parameter-oids","errorCode":null,"errorMessage":"too many parameter oids","messagePattern":"too many parameter oids","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgproto3/parameter_description.go","lineNumber":48,"sourceCode":"\tbuf.Next(2)\n\t// Instead infer parameter count by remaining size of message\n\tparameterCount := buf.Len() / 4\n\n\t*dst = ParameterDescription{ParameterOIDs: make([]uint32, parameterCount)}\n\n\tfor i := range parameterCount {\n\t\tdst.ParameterOIDs[i] = binary.BigEndian.Uint32(buf.Next(4))\n\t}\n\n\treturn nil\n}\n\n// Encode encodes src into dst. dst will include the 1 byte message type identifier and the 4 byte message length.\nfunc (src *ParameterDescription) Encode(dst []byte) ([]byte, error) {\n\tdst, sp := beginMessage(dst, 't')\n\n\tif len(src.ParameterOIDs) > math.MaxUint16 {\n\t\treturn nil, errors.New(\"too many parameter oids\")\n\t}\n\tdst = pgio.AppendUint16(dst, uint16(len(src.ParameterOIDs)))\n\tfor _, oid := range src.ParameterOIDs {\n\t\tdst = pgio.AppendUint32(dst, oid)\n\t}\n\n\treturn finishMessage(dst, sp)\n}\n\n// MarshalJSON implements encoding/json.Marshaler.\nfunc (src ParameterDescription) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(struct {\n\t\tType          string\n\t\tParameterOIDs []uint32\n\t}{\n\t\tType:          \"ParameterDescription\",\n\t\tParameterOIDs: src.ParameterOIDs,\n\t})","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgproto3/parameter_description.go#L30-L66","documentation":"Encode-time guard in the ParameterDescription wire message encoder: the number of parameter OIDs exceeds math.MaxUint16, because the wire format encodes the count in an unsigned 16-bit field. The oversized ParameterOIDs slice is the faulty input; this cannot occur with a compliant server.","triggerScenarios":"Thrown at pgproto3/parameter_description.go:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the number of distinct parameters to at most 65535","Split the operation into multiple statements"],"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"}