{"id":"432395603b877ff3","repo":"jackc/pgx","slug":"lower-cannot-be-null-unless-lowertype-is-unbounded","errorCode":null,"errorMessage":"Lower cannot be NULL unless LowerType is Unbounded","messagePattern":"Lower cannot be NULL unless LowerType is Unbounded","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/range_codec.go","lineNumber":110,"sourceCode":"\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown LowerType: %v\", lowerType)\n\t}\n\n\tswitch upperType {\n\tcase Inclusive:\n\t\trangeType |= upperInclusiveMask\n\tcase Unbounded:\n\t\trangeType |= upperUnboundedMask\n\tcase Exclusive:\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown UpperType: %v\", upperType)\n\t}\n\n\tbuf = append(buf, rangeType)\n\n\tif lowerType != Unbounded {\n\t\tif lower == nil {\n\t\t\treturn nil, fmt.Errorf(\"Lower cannot be NULL unless LowerType is Unbounded\")\n\t\t}\n\n\t\tsp := len(buf)\n\t\tbuf = pgio.AppendInt32(buf, -1)\n\n\t\tlowerPlan := plan.m.PlanEncode(plan.rc.ElementType.OID, BinaryFormatCode, lower)\n\t\tif lowerPlan == nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot encode %v as element of range\", lower)\n\t\t}\n\n\t\tbuf, err = lowerPlan.Encode(lower, buf)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to encode %v as element of range: %w\", lower, err)\n\t\t}\n\t\tif buf == nil {\n\t\t\treturn nil, fmt.Errorf(\"Lower cannot be NULL unless LowerType is Unbounded\")\n\t\t}\n","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/range_codec.go#L92-L128","documentation":"Error \"Lower cannot be NULL unless LowerType is Unbounded\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/range_codec.go:110 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}