grafana/k6 · error
unable to run Thresholds; reason: unknown sink type
Error message
unable to run Thresholds; reason: unknown sink type
What it means
Thresholds.Run switches on the concrete sink type of the metric the thresholds apply to; the default branch fires when the metric's Sink is not one of the supported types (Counter, Gauge, Trend, Rate). This means thresholds were configured on a metric whose sink implementation the threshold engine cannot read — an internal/registration inconsistency rather than a user expression problem.
Source
Thrown at metrics/thresholds.go:214
// Parse the percentile thresholds and insert them in
// the sinks mapping.
for _, threshold := range ts.Thresholds {
if threshold.parsed.AggregationMethod != tokenPercentile {
continue
}
key := fmt.Sprintf("p(%g)", threshold.parsed.AggregationValue.Float64)
ts.sinked[key] = sinkImpl.P(threshold.parsed.AggregationValue.Float64 / 100)
}
case *RateSink:
// We want to avoid division by zero, which
// would lead to [#2520](https://github.com/grafana/k6/issues/2520)
if sinkImpl.Total > 0 {
ts.sinked["rate"] = float64(sinkImpl.Trues) / float64(sinkImpl.Total)
}
default:
return false, fmt.Errorf("unable to run Thresholds; reason: unknown sink type")
}
return ts.runAll(duration)
}
// Parse parses the Thresholds and fills each Threshold.parsed field with the result.
// It effectively asserts they are syntaxically correct.
func (ts *Thresholds) Parse() error {
for _, t := range ts.Thresholds {
parsed, err := parseThresholdExpression(t.Source)
if err != nil {
return err
}
t.parsed = parsed
}
return nilView on GitHub (pinned to 01ffac6f24)
Solutions
- Check which metric the thresholds are defined on and verify it was registered with a standard type (counter, gauge, trend, rate)
- If using a custom metric/extension, ensure its sink implements one of the known sink types
- Report as a k6 bug if the metric is a built-in type
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at metrics/thresholds.go:214 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/69e52ed3dd3de279.
Report an issue: GitHub.