{"id":"f7fc26e8204a781a","repo":"go-redis/redis","slug":"cannot-convert-t-to-float64","errorCode":null,"errorMessage":"cannot convert %T to float64","messagePattern":"cannot convert %T to float64","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/routing/aggregator.go","lineNumber":670,"sourceCode":"\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:\n\t\treturn float64(v), nil\n\tcase int64:\n\t\treturn float64(v), nil\n\tcase float32:\n\t\treturn float64(v), nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"cannot convert %T to float64\", val)\n\t}\n}\n\nfunc toBool(val interface{}) (bool, error) {\n\tif val == nil {\n\t\treturn false, nil\n\t}\n\tswitch v := val.(type) {\n\tcase bool:\n\t\treturn v, nil\n\tcase int64:\n\t\treturn v != 0, nil\n\tcase int:\n\t\treturn v != 0, nil\n\tdefault:\n\t\treturn false, fmt.Errorf(\"cannot convert %T to bool\", val)\n\t}\n}","sourceCodeStart":652,"sourceCodeEnd":688,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/internal/routing/aggregator.go#L652-L688","documentation":"Error \"cannot convert %T to float64\" thrown in go-redis/redis.","triggerScenarios":"Thrown at internal/routing/aggregator.go:670 when the library encounters an invalid state.","commonSituations":"Validate shard result types ahead of float aggregation.","solutions":["Ensure aggregated values are numeric (int/float/string-number) before float64 conversion","Filter or convert non-numeric results first"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}