{"id":"474dd62d0d9ed52c","repo":"go-redis/redis","slug":"cannot-convert-float-f-to-int64","errorCode":null,"errorMessage":"cannot convert float %f to int64","messagePattern":"cannot convert float (.+?) to int64","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/routing/aggregator.go","lineNumber":645,"sourceCode":"\t\treturn nil, ErrOrAggregation\n\t}\n\treturn a.res.Load(), nil\n}\n\nfunc toInt64(val interface{}) (int64, error) {\n\tif val == nil {\n\t\treturn 0, nil\n\t}\n\tswitch v := val.(type) {\n\tcase int64:\n\t\treturn v, nil\n\tcase int:\n\t\treturn int64(v), nil\n\tcase int32:\n\t\treturn int64(v), nil\n\tcase float64:\n\t\tif v != math.Trunc(v) {\n\t\t\treturn 0, fmt.Errorf(\"cannot convert float %f to int64\", v)\n\t\t}\n\t\treturn int64(v), nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"cannot convert %T to int64\", val)\n\t}\n}\n\nfunc toFloat64(val interface{}) (float64, error) {\n\tif val == nil {\n\t\treturn 0, nil\n\t}\n\n\tswitch v := val.(type) {\n\tcase float64:\n\t\treturn v, nil\n\tcase int:\n\t\treturn float64(v), nil\n\tcase int32:","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/internal/routing/aggregator.go#L627-L663","documentation":"Error \"cannot convert float %f to int64\" thrown in go-redis/redis.","triggerScenarios":"Thrown at internal/routing/aggregator.go:645 when the library encounters an invalid state.","commonSituations":"Range-check float-to-int conversions in aggregation inputs.","solutions":["Clamp or round the float to int64 range before aggregation","Keep values in float64 if precision/range requires it"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}