{"record":{"id":"96072f912afa8484","repo":"jackc/pgx","slug":"cannot-scan-null-into-int64","errorCode":null,"errorMessage":"cannot scan NULL into *int64","messagePattern":"cannot scan NULL into \\*int64","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/builtin_wrappers.go","lineNumber":92,"sourceCode":"\tif v.Int64 > math.MaxInt32 {\n\t\treturn fmt.Errorf(\"%d is greater than maximum value for int32\", v.Int64)\n\t}\n\t*w = int32Wrapper(v.Int64)\n\n\treturn nil\n}\n\nfunc (w int32Wrapper) Int64Value() (Int8, error) {\n\treturn Int8{Int64: int64(w), Valid: true}, nil\n}\n\ntype int64Wrapper int64\n\nfunc (w int64Wrapper) SkipUnderlyingTypePlan() {}\n\nfunc (w *int64Wrapper) ScanInt64(v Int8) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *int64\")\n\t}\n\n\t*w = int64Wrapper(v.Int64)\n\n\treturn nil\n}\n\nfunc (w int64Wrapper) Int64Value() (Int8, error) {\n\treturn Int8{Int64: int64(w), Valid: true}, nil\n}\n\ntype intWrapper int\n\nfunc (w intWrapper) SkipUnderlyingTypePlan() {}\n\nfunc (w *intWrapper) ScanInt64(v Int8) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *int\")","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/builtin_wrappers.go#L74-L110","documentation":"int64Wrapper.ScanInt64 received an invalid (NULL) Int8 while the destination is a plain Go int64, which cannot store NULL.","triggerScenarios":"Thrown at pgtype/builtin_wrappers.go:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Scan into *int64 or a nullable wrapper (pgtype.Int8, sql.NullInt64)","Exclude NULLs in the query"],"exampleFix":null,"handlingStrategy":"type-guard","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"}