{"record":{"id":"a07447afaf412836","repo":"jackc/pgx","slug":"cannot-scan-v-into-uint64","errorCode":null,"errorMessage":"cannot scan %v into *uint64","messagePattern":"cannot scan (.+?) into \\*uint64","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/builtin_wrappers.go","lineNumber":238,"sourceCode":"\tif uint64(w) > uint64(math.MaxInt64) {\n\t\treturn Int8{}, fmt.Errorf(\"%d is greater than maximum value for int64\", w)\n\t}\n\n\treturn Int8{Int64: int64(w), Valid: true}, nil\n}\n\nfunc (w *uint64Wrapper) ScanNumeric(v Numeric) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *uint64\")\n\t}\n\n\tbi, err := v.toBigInt()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot scan into *uint64: %w\", err)\n\t}\n\n\tif !bi.IsUint64() {\n\t\treturn fmt.Errorf(\"cannot scan %v into *uint64\", bi.String())\n\t}\n\n\t*w = uint64Wrapper(bi.Uint64())\n\n\treturn nil\n}\n\nfunc (w uint64Wrapper) NumericValue() (Numeric, error) {\n\treturn Numeric{Int: new(big.Int).SetUint64(uint64(w)), Valid: true}, nil\n}\n\ntype uintWrapper uint\n\nfunc (w uintWrapper) SkipUnderlyingTypePlan() {}\n\nfunc (w *uintWrapper) ScanInt64(v Int8) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *uint64\")","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/builtin_wrappers.go#L220-L256","documentation":"ScanNumeric was handed a NULL Numeric while scanning into a *uint64, which cannot represent NULL. The error is a null guard inside the uint64Wrapper conversion path; the offending input is a NULL numeric column being scanned into a plain uint64 (not *uint64 or pgtype.Numeric).","triggerScenarios":"Thrown at pgtype/builtin_wrappers.go:238 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a Go type wide enough for the value (e.g. *big.Int, Numeric, or *int64 for values within int64 range)","Add a CHECK constraint on the column so out-of-range numerics cannot be stored","Scan into pgtype.Numeric and inspect it before converting"],"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"}