{"id":"083da3537983dfcc","repo":"jackc/pgx","slug":"cannot-scan-null-into-compositefields","errorCode":null,"errorMessage":"cannot scan NULL into CompositeFields","messagePattern":"cannot scan NULL into CompositeFields","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/composite.go","lineNumber":616,"sourceCode":"\treturn src\n}\n\n// CompositeFields represents the values of a composite value. It can be used as an encoding source or as a scan target.\n// It cannot scan a NULL, but the composite fields can be NULL.\ntype CompositeFields []any\n\nfunc (cf CompositeFields) SkipUnderlyingTypePlan() {}\n\nfunc (cf CompositeFields) IsNull() bool {\n\treturn cf == nil\n}\n\nfunc (cf CompositeFields) Index(i int) any {\n\treturn cf[i]\n}\n\nfunc (cf CompositeFields) ScanNull() error {\n\treturn fmt.Errorf(\"cannot scan NULL into CompositeFields\")\n}\n\nfunc (cf CompositeFields) ScanIndex(i int) any {\n\treturn cf[i]\n}\n","sourceCodeStart":598,"sourceCodeEnd":622,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/composite.go#L598-L622","documentation":"Error \"cannot scan NULL into CompositeFields\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/composite.go:616 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}