grafana/k6 · error
metric not registered %q
Error message
metric not registered %q
What it means
parseAndEmitWebVitalMetric parsed the web-vitals payload but the reported metric name (e.g. CLS, LCP, FCP, TTFID, INP) is not present in the k6Metrics.WebVitals registry. Either web-vitals emitted a new/unknown metric name or the metric registration step was skipped — an internal consistency guard.
Source
Thrown at internal/js/modules/k6/browser/common/frame_session.go:360
wv := struct {
ID string
Name string
Value json.Number
Rating string
Delta json.Number
NumEntries json.Number
NavigationType string
URL string
SpanID string
}{}
if err := json.Unmarshal([]byte(object), &wv); err != nil {
return fmt.Errorf("json couldn't be parsed: %w", err)
}
metric, ok := fs.k6Metrics.WebVitals[wv.Name]
if !ok {
return fmt.Errorf("metric not registered %q", wv.Name)
}
value, err := wv.Value.Float64()
if err != nil {
return fmt.Errorf("value couldn't be parsed %q", wv.Value)
}
state := fs.vu.State()
tags := state.Tags.GetCurrentValues().Tags
if state.Options.SystemTags.Has(k6metrics.TagURL) {
tags = handleURLTag(fs.page, wv.URL, http.MethodGet, tags)
}
tags = tags.With("rating", wv.Rating)
now := time.Now()
pushIfNotDone(fs.vu.Context(), fs.logger, state.Samples, k6metrics.ConnectedSamples{
Samples: []k6metrics.Sample{View on GitHub (pinned to 94169daab2)
Solutions
- Update k6 so the web-vitals names and registered metrics match
- Report to grafana/k6 with the unknown metric name from the error
- Disable web-vitals collection if not needed, to avoid the code path
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame_session.go:360 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@94169daab2 (2026-08-18).
Data as JSON: /api/errors/ae047581f09717fa.
Report an issue: GitHub.