{"record":{"id":"2ee0f5bec9c50e63","repo":"jackc/pgx","slug":"anyarrayarrayreflect-cannot-scan-null-into-v","errorCode":null,"errorMessage":"anyArrayArrayReflect: cannot scan NULL into %v","messagePattern":"anyArrayArrayReflect: cannot scan NULL into (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/builtin_wrappers.go","lineNumber":932,"sourceCode":"type anyArrayArrayReflect struct {\n\tarray reflect.Value\n}\n\nfunc (a anyArrayArrayReflect) Dimensions() []ArrayDimension {\n\treturn []ArrayDimension{{Length: int32(a.array.Len()), LowerBound: 1}}\n}\n\nfunc (a anyArrayArrayReflect) Index(i int) any {\n\treturn a.array.Index(i).Interface()\n}\n\nfunc (a anyArrayArrayReflect) IndexType() any {\n\treturn reflect.New(a.array.Type().Elem()).Elem().Interface()\n}\n\nfunc (a *anyArrayArrayReflect) SetDimensions(dimensions []ArrayDimension) error {\n\tif dimensions == nil {\n\t\treturn fmt.Errorf(\"anyArrayArrayReflect: cannot scan NULL into %v\", a.array.Type().String())\n\t}\n\n\tif len(dimensions) != 1 {\n\t\treturn fmt.Errorf(\"anyArrayArrayReflect: cannot scan multi-dimensional array into %v\", a.array.Type().String())\n\t}\n\n\tif int(dimensions[0].Length) != a.array.Len() {\n\t\treturn fmt.Errorf(\"anyArrayArrayReflect: cannot scan array with length %v into %v\", dimensions[0].Length, a.array.Type().String())\n\t}\n\n\treturn nil\n}\n\nfunc (a *anyArrayArrayReflect) ScanIndex(i int) any {\n\treturn a.array.Index(i).Addr().Interface()\n}\n\nfunc (a *anyArrayArrayReflect) ScanIndexType() any {","sourceCodeStart":914,"sourceCodeEnd":950,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/builtin_wrappers.go#L914-L950","documentation":"Returned by anyArrayArrayReflect.SetDimensions when a NULL array is scanned into a reflect-based non-pointer slice target. A reflect.Value slice cannot be set to nil through this path, so NULL is rejected.","triggerScenarios":"Thrown at pgtype/builtin_wrappers.go:932 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Scan into a pointer type (*[]T) which supports NULL","Use COALESCE to an empty array (e.g. '{}') in the query"],"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"}