SigNoz/signoz · error

threshold param should be a float

Error message

threshold param should be a float

What it means

For the clamp/cutOff family, Args[0] must be float64. If it isn't, the code first checks it's at least a string; this error is returned when Args[0] is neither float64 nor string (e.g. bool, nil, map).

Source

Thrown at pkg/query-service/model/v3/v3.go:1156

						return fmt.Errorf("alpha param should be a float")
					}
					function.Args[0] = alpha
				}
				if alpha < 0 || alpha > 1 {
					return fmt.Errorf("alpha param should be between 0 and 1")
				}
			} else if function.Name == FunctionNameCutOffMax ||
				function.Name == FunctionNameCutOffMin ||
				function.Name == FunctionNameClampMax ||
				function.Name == FunctionNameClampMin {
				if len(function.Args) == 0 {
					return fmt.Errorf("threshold param missing in query")
				}
				_, ok := function.Args[0].(float64)
				if !ok {
					// if string, attempt to convert to float
					if _, ok := function.Args[0].(string); !ok {
						return fmt.Errorf("threshold param should be a float")
					}
					threshold, err := strconv.ParseFloat(function.Args[0].(string), 64)
					if err != nil {
						return fmt.Errorf("threshold param should be a float")
					}
					function.Args[0] = threshold
				}
			}
		}
	}

	return nil
}

type FilterSet struct {
	Operator string       `json:"op,omitempty"`
	Items    []FilterItem `json:"items"`
}

View on GitHub (pinned to 5069bf80b0)

Solutions

  1. Send the threshold as a JSON number or numeric string
  2. Guard the value is a number before building the query

Example fix

// before
{"name":"cutOffMax","args":[true]}
// after
{"name":"cutOffMax","args":[100]}
Defensive patterns

Strategy: type-guard

Validate before calling

switch f.Args[0].(type) { case float64, string: default: return errors.New("threshold must be number or numeric string") }

Type guard

func isNumericLike(a interface{}) bool { switch a.(type) { case float64, string: return true }; return false }

Prevention

When it happens

Trigger: "args":[true] or [null] on cutOffMin/clampMax etc. — any non-float, non-string JSON value.

Common situations: Serialization bugs where the threshold becomes null; booleans used as 0/1 substitutes; nested objects passed by mistake.

Related errors


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