{"record":{"id":"8479bb007376649d","repo":"jackc/pgx","slug":"d-is-greater-than-maximum-value-for-uint8","errorCode":null,"errorMessage":"%d is greater than maximum value for uint8","messagePattern":"(.+?) is greater than maximum value for uint8","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/builtin_wrappers.go","lineNumber":142,"sourceCode":"\nfunc (w intWrapper) Int64Value() (Int8, error) {\n\treturn Int8{Int64: int64(w), Valid: true}, nil\n}\n\ntype uint8Wrapper uint8\n\nfunc (w uint8Wrapper) SkipUnderlyingTypePlan() {}\n\nfunc (w *uint8Wrapper) ScanInt64(v Int8) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *uint8\")\n\t}\n\n\tif v.Int64 < 0 {\n\t\treturn fmt.Errorf(\"%d is less than minimum value for uint8\", v.Int64)\n\t}\n\tif v.Int64 > math.MaxUint8 {\n\t\treturn fmt.Errorf(\"%d is greater than maximum value for uint8\", v.Int64)\n\t}\n\t*w = uint8Wrapper(v.Int64)\n\n\treturn nil\n}\n\nfunc (w uint8Wrapper) Int64Value() (Int8, error) {\n\treturn Int8{Int64: int64(w), Valid: true}, nil\n}\n\ntype uint16Wrapper uint16\n\nfunc (w uint16Wrapper) SkipUnderlyingTypePlan() {}\n\nfunc (w *uint16Wrapper) ScanInt64(v Int8) error {\n\tif !v.Valid {\n\t\treturn fmt.Errorf(\"cannot scan NULL into *uint16\")\n\t}","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/builtin_wrappers.go#L124-L160","documentation":"Range guard converting an int64 into Go uint8: the value exceeds math.MaxUint8 and would overflow, so the conversion is refused.","triggerScenarios":"Thrown at pgtype/builtin_wrappers.go:142 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Scan into a wider unsigned/signed type (uint16, uint32, int64)","Constrain the column or query results to the 0-255 range"],"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"}