{"id":"ae2c92efafada2e4","repo":"jackc/pgx","slug":"unable-to-encode-v-ae2c92","errorCode":null,"errorMessage":"unable to encode %v","messagePattern":"unable to encode (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/multirange.go","lineNumber":113,"sourceCode":"\tbuf = append(buf, '{')\n\n\tvar encodePlan EncodePlan\n\tvar lastElemType reflect.Type\n\tinElemBuf := make([]byte, 0, 32)\n\tfor i := range elementCount {\n\t\tif i > 0 {\n\t\t\tbuf = append(buf, ',')\n\t\t}\n\n\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","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/multirange.go#L95-L131","documentation":"Error \"unable to encode %v\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/multirange.go:113 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}