{"record":{"id":"52ffda222c576d7a","repo":"jackc/pgx","slug":"cannot-scan-into-v-from-range-element-w","errorCode":null,"errorMessage":"cannot scan into %v from range element: %w","messagePattern":"cannot scan into (.+?) from range element: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/range_codec.go","lineNumber":283,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\n\tif ubr.LowerType == Empty {\n\t\treturn rangeScanner.SetBoundTypes(ubr.LowerType, ubr.UpperType)\n\t}\n\n\tlowerTarget, upperTarget := rangeScanner.ScanBounds()\n\n\tif ubr.LowerType == Inclusive || ubr.LowerType == Exclusive {\n\t\tlowerPlan := plan.m.PlanScan(plan.rc.ElementType.OID, BinaryFormatCode, lowerTarget)\n\t\tif lowerPlan == nil {\n\t\t\treturn fmt.Errorf(\"cannot scan into %v from range element\", lowerTarget)\n\t\t}\n\n\t\terr = lowerPlan.Scan(ubr.Lower, lowerTarget)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot scan into %v from range element: %w\", lowerTarget, err)\n\t\t}\n\t}\n\n\tif ubr.UpperType == Inclusive || ubr.UpperType == Exclusive {\n\t\tupperPlan := plan.m.PlanScan(plan.rc.ElementType.OID, BinaryFormatCode, upperTarget)\n\t\tif upperPlan == nil {\n\t\t\treturn fmt.Errorf(\"cannot scan into %v from range element\", upperTarget)\n\t\t}\n\n\t\terr = upperPlan.Scan(ubr.Upper, upperTarget)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot scan into %v from range element: %w\", upperTarget, err)\n\t\t}\n\t}\n\n\treturn rangeScanner.SetBoundTypes(ubr.LowerType, ubr.UpperType)\n}\n","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/range_codec.go#L265-L301","documentation":"The lower bound's element scan plan ran and failed; the range scanner wraps the underlying error together with the failing target so the caller can see which bound could not be decoded. The root cause is the element-level decode failure.","triggerScenarios":"Thrown at pgtype/range_codec.go:283 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error to identify the element decode failure","Check that the range element values are valid for the target type","Fix the target type or element data based on the underlying error"],"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"}