grafana/k6 · error

failed parsing threshold expresion's %q right hand side; rea

Error message

failed parsing threshold expresion's %q right hand side; reason: %w

What it means

The right-hand side of the threshold expression failed to parse into a float64: after the operator was found, the value string is not a valid number (empty, contains non-numeric characters, or is a malformed decimal).

Source

Thrown at metrics/thresholds_parser.go:90

func parseThresholdExpression(input string) (*thresholdExpression, error) {
	// Scanning makes no assumption on the underlying values, and only
	// checks that the expression has the right format.
	method, operator, value, err := scanThresholdExpression(input)
	if err != nil {
		return nil, fmt.Errorf("failed parsing threshold expression %q; reason: %w", input, err)
	}

	parsedMethod, parsedMethodValue, err := parseThresholdAggregationMethod(method)
	if err != nil {
		err = fmt.Errorf("failed parsing threshold expression's %q left hand side; "+
			"reason: %w", input, err,
		)
		return nil, err
	}

	parsedValue, err := strconv.ParseFloat(value, 64)
	if err != nil {
		err = fmt.Errorf("failed parsing threshold expresion's %q right hand side; "+
			"reason: %w", input, err,
		)
		return nil, err
	}

	condition := &thresholdExpression{
		AggregationMethod: parsedMethod,
		AggregationValue:  parsedMethodValue,
		Operator:          operator,
		Value:             parsedValue,
	}

	return condition, nil
}

// Define accepted threshold expression operators tokens
const (
	tokenLessEqual     = "<="

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Put a plain number after the operator, e.g. 'med<300' or 'rate==0.01'
  2. Remove units, quotes, or variables from the right-hand side ('400ms' is invalid, use '400')
  3. Check for typos like '<300,>' or double operators
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at metrics/thresholds_parser.go:90 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18). Data as JSON: /api/errors/a48e9d3275722e6e. Report an issue: GitHub.