{"id":"583aeda68a0bf542","repo":"jackc/pgx","slug":"multirange-cannot-contain-null-element","errorCode":null,"errorMessage":"multirange cannot contain NULL element","messagePattern":"multirange cannot contain NULL element","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/multirange.go","lineNumber":123,"sourceCode":"\t\telem := multirange.Index(i)\n\t\tvar elemBuf []byte\n\t\tif elem != nil {\n\t\t\telemType := reflect.TypeOf(elem)\n\t\t\tif lastElemType != elemType {\n\t\t\t\tlastElemType = elemType\n\t\t\t\tencodePlan = p.m.PlanEncode(p.ac.ElementType.OID, TextFormatCode, elem)\n\t\t\t\tif encodePlan == nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unable to encode %v\", multirange.Index(i))\n\t\t\t\t}\n\t\t\t}\n\t\t\telemBuf, err = encodePlan.Encode(elem, inElemBuf)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tif elemBuf == nil {\n\t\t\treturn nil, fmt.Errorf(\"multirange cannot contain NULL element\")\n\t\t} else {\n\t\t\tbuf = append(buf, elemBuf...)\n\t\t}\n\t}\n\n\tbuf = append(buf, '}')\n\n\treturn buf, nil\n}\n\ntype encodePlanMultirangeCodecBinary struct {\n\tac  *MultirangeCodec\n\tm   *Map\n\toid uint32\n}\n\nfunc (p *encodePlanMultirangeCodecBinary) Encode(value any, buf []byte) (newBuf []byte, err error) {\n\tmultirange := value.(MultirangeGetter)","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/multirange.go#L105-L141","documentation":"Error \"multirange cannot contain NULL element\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/multirange.go:123 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}