go-redis/redis · error
cannot convert float %f to int64
Error message
cannot convert float %f to int64
What it means
Error "cannot convert float %f to int64" thrown in go-redis/redis.
Source
Thrown at internal/routing/aggregator.go:645
return nil, ErrOrAggregation
}
return a.res.Load(), nil
}
func toInt64(val interface{}) (int64, error) {
if val == nil {
return 0, nil
}
switch v := val.(type) {
case int64:
return v, nil
case int:
return int64(v), nil
case int32:
return int64(v), nil
case float64:
if v != math.Trunc(v) {
return 0, fmt.Errorf("cannot convert float %f to int64", v)
}
return int64(v), nil
default:
return 0, fmt.Errorf("cannot convert %T to int64", val)
}
}
func toFloat64(val interface{}) (float64, error) {
if val == nil {
return 0, nil
}
switch v := val.(type) {
case float64:
return v, nil
case int:
return float64(v), nil
case int32:View on GitHub (pinned to 36d97525cd)
Solutions
- Clamp or round the float to int64 range before aggregation
- Keep values in float64 if precision/range requires it
When it happens
Trigger: Thrown at internal/routing/aggregator.go:645 when the library encounters an invalid state.
Common situations: Range-check float-to-int conversions in aggregation inputs.
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/474dd62d0d9ed52c.json.
Report an issue: GitHub.