{"record":{"id":"438e96b091bee739","repo":"SigNoz/signoz","slug":"expected-float64-got-t","errorCode":null,"errorMessage":"expected float64, got %T","messagePattern":"expected float64, got %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/query-service/postprocess/formula.go","lineNumber":146,"sourceCode":"\t\tfor _, v := range expression.Vars() {\n\t\t\tif _, ok := values[v]; !ok {\n\t\t\t\tcanEval = false\n\t\t\t}\n\t\t}\n\n\t\tif !canEval {\n\t\t\t// not enough values for expression evaluation\n\t\t\tcontinue\n\t\t}\n\n\t\tnewValue, err := expression.Evaluate(values)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tval, ok := newValue.(float64)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"expected float64, got %T\", newValue)\n\t\t}\n\n\t\tif math.IsNaN(val) || math.IsInf(val, 0) {\n\t\t\tcontinue\n\t\t}\n\n\t\tresultSeries.Points = append(resultSeries.Points, v3.Point{\n\t\t\tTimestamp: timestamp,\n\t\t\tValue:     val,\n\t\t})\n\t}\n\treturn resultSeries, nil\n}\n\n// Main function to process the Results\n// A series can be \"join\"ed with other series if they have the same label set or one is a subset of the other.\n// 1. Find all unique label sets\n// 2. For each unique label set, find a series that matches the label set from each query result","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/postprocess/formula.go#L128-L164","documentation":"During formula evaluation in postprocess, after applying a formula function to series values the result is asserted to be float64. If the formula's expression or a custom function returns a non-float (string, nil, etc.), joinAndCalculate fails with the observed Go type.","triggerScenarios":"A query with a formula whose evaluation yields a non-numeric value — e.g. a formula referencing a string column, a function returning nil, or NaN-producing expressions that escape as other types through custom formula funcs.","commonSituations":"Complex formulas mixing series of different types, version mismatches where a formula function's return type changed, or division producing nil in some row implementations.","solutions":["Simplify the formula to isolate which expression produces the non-float value","Ensure all series referenced in the formula are numeric and present (no missing series)","Update SigNoz so formula handling matches the frontend's formula grammar"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure all series used in the formula are numeric before querying\nfor _, s := range series { if s.Values == nil { return errors.New(\"missing series for formula\") } }","typeGuard":"func isFloat64(v interface{}) bool { _, ok := v.(float64); return ok }","tryCatchPattern":"res, err := qs.processResults(q)\nif err != nil {\n  if strings.Contains(err.Error(), \"expected float64\") { return nil, fmt.Errorf(\"formula produced non-numeric output; check expression %q\", formula) }\n  return nil, err\n}","preventionTips":["Keep formulas to arithmetic over numeric series","Simplify complex formulas to isolate failures","Match frontend/backend versions"],"tags":["signoz","formula","postprocess","type-mismatch"],"backgroundTag":"formula-type-mismatch","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}