{"id":"7127d7e5fe476fbe","repo":"jackc/pgx","slug":"cannot-scan-null-into-t-7127d7","errorCode":null,"errorMessage":"cannot scan NULL into %T","messagePattern":"cannot scan NULL into %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/text.go","lineNumber":186,"sourceCode":"}\n\nfunc (c TextCodec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error) {\n\treturn c.DecodeValue(m, oid, format, src)\n}\n\nfunc (c TextCodec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error) {\n\tif src == nil {\n\t\treturn nil, nil\n\t}\n\n\treturn string(src), nil\n}\n\ntype scanPlanTextAnyToString struct{}\n\nfunc (scanPlanTextAnyToString) Scan(src []byte, dst any) error {\n\tif src == nil {\n\t\treturn fmt.Errorf(\"cannot scan NULL into %T\", dst)\n\t}\n\n\tp := (dst).(*string)\n\t*p = string(src)\n\n\treturn nil\n}\n\ntype scanPlanAnyToNewByteSlice struct{}\n\nfunc (scanPlanAnyToNewByteSlice) Scan(src []byte, dst any) error {\n\tp := (dst).(*[]byte)\n\tif src == nil {\n\t\t*p = nil\n\t} else {\n\t\t*p = make([]byte, len(src))\n\t\tcopy(*p, src)\n\t}","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/text.go#L168-L204","documentation":"Error \"cannot scan NULL into %T\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/text.go:186 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}