{"record":{"id":"9d06cb245602a4de","repo":"jackc/pgx","slug":"cannot-scan-null-into-v","errorCode":null,"errorMessage":"cannot scan NULL into %#v","messagePattern":"cannot scan NULL into %#v","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/builtin_wrappers.go","lineNumber":736,"sourceCode":"\treturn w.s == nil\n}\n\nfunc (w structWrapper) Index(i int) any {\n\tif i >= len(w.exportedFields) {\n\t\treturn fmt.Errorf(\"%#v only has %d public fields - %d is out of bounds\", w.s, len(w.exportedFields), i)\n\t}\n\n\treturn w.exportedFields[i].Interface()\n}\n\n// ptrStructWrapper implements CompositeIndexScanner for a pointer to a struct.\ntype ptrStructWrapper struct {\n\ts              any\n\texportedFields []reflect.Value\n}\n\nfunc (w *ptrStructWrapper) ScanNull() error {\n\treturn fmt.Errorf(\"cannot scan NULL into %#v\", w.s)\n}\n\nfunc (w *ptrStructWrapper) ScanIndex(i int) any {\n\tif i >= len(w.exportedFields) {\n\t\treturn fmt.Errorf(\"%#v only has %d public fields - %d is out of bounds\", w.s, len(w.exportedFields), i)\n\t}\n\n\treturn w.exportedFields[i].Addr().Interface()\n}\n\ntype anySliceArrayReflect struct {\n\tslice reflect.Value\n}\n\nfunc (a anySliceArrayReflect) Dimensions() []ArrayDimension {\n\tif a.slice.IsNil() {\n\t\treturn nil\n\t}","sourceCodeStart":718,"sourceCodeEnd":754,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/builtin_wrappers.go#L718-L754","documentation":"Returned by ptrStructWrapper.ScanNull when a NULL composite is scanned into a pointer-to-struct target. The wrapper deliberately refuses to NULL out the caller's struct pointer, since silently replacing it could hide the NULL from the program.","triggerScenarios":"Thrown at pgtype/builtin_wrappers.go:736 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Scan into a **struct (pointer to pointer) so NULL can be represented","Use COALESCE or filter out NULL rows 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"}