SigNoz/signoz · error

expected float64, got %T

Error message

expected float64, got %T

What it means

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.

Source

Thrown at pkg/query-service/postprocess/formula.go:146

		for _, v := range expression.Vars() {
			if _, ok := values[v]; !ok {
				canEval = false
			}
		}

		if !canEval {
			// not enough values for expression evaluation
			continue
		}

		newValue, err := expression.Evaluate(values)
		if err != nil {
			return nil, err
		}

		val, ok := newValue.(float64)
		if !ok {
			return nil, fmt.Errorf("expected float64, got %T", newValue)
		}

		if math.IsNaN(val) || math.IsInf(val, 0) {
			continue
		}

		resultSeries.Points = append(resultSeries.Points, v3.Point{
			Timestamp: timestamp,
			Value:     val,
		})
	}
	return resultSeries, nil
}

// Main function to process the Results
// A series can be "join"ed with other series if they have the same label set or one is a subset of the other.
// 1. Find all unique label sets
// 2. For each unique label set, find a series that matches the label set from each query result

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Simplify the formula to isolate which expression produces the non-float value
  2. Ensure all series referenced in the formula are numeric and present (no missing series)
  3. Update SigNoz so formula handling matches the frontend's formula grammar
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure all series used in the formula are numeric before querying
for _, s := range series { if s.Values == nil { return errors.New("missing series for formula") } }

Type guard

func isFloat64(v interface{}) bool { _, ok := v.(float64); return ok }

Try / catch

res, err := qs.processResults(q)
if err != nil {
  if strings.Contains(err.Error(), "expected float64") { return nil, fmt.Errorf("formula produced non-numeric output; check expression %q", formula) }
  return nil, err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/438e96b091bee739. Report an issue: GitHub.