{"id":"cfca058f32d2483b","repo":"jackc/pgx","slug":"cannot-scan-null-into-t-cfca05","errorCode":null,"errorMessage":"cannot scan NULL into %T","messagePattern":"cannot scan NULL into %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/json.go","lineNumber":211,"sourceCode":"}\n\ntype scanPlanJSONToJSONUnmarshal struct {\n\tunmarshal func(data []byte, v any) error\n}\n\nfunc (s *scanPlanJSONToJSONUnmarshal) Scan(src []byte, dst any) error {\n\tif src == nil {\n\t\tdstValue := reflect.ValueOf(dst)\n\t\tif dstValue.Kind() == reflect.Pointer {\n\t\t\tel := dstValue.Elem()\n\t\t\tswitch el.Kind() {\n\t\t\tcase reflect.Pointer, reflect.Slice, reflect.Map, reflect.Interface:\n\t\t\t\tel.Set(reflect.Zero(el.Type()))\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\treturn fmt.Errorf(\"cannot scan NULL into %T\", dst)\n\t}\n\n\tv := reflect.ValueOf(dst)\n\tif v.Kind() != reflect.Pointer || v.IsNil() {\n\t\treturn fmt.Errorf(\"cannot scan into non-pointer or nil destinations %T\", dst)\n\t}\n\n\telem := v.Elem()\n\telem.Set(reflect.Zero(elem.Type()))\n\n\treturn s.unmarshal(src, dst)\n}\n\nfunc (c *JSONCodec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error) {\n\tif src == nil {\n\t\treturn nil, nil\n\t}\n","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/json.go#L193-L229","documentation":"Error \"cannot scan NULL into %T\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/json.go:211 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}