grafana/k6 · error

value couldn't be parsed

Error message

value couldn't be parsed %q

What it means

After successfully matching a web-vitals metric, its Value field (a json.Number) could not be converted with Float64(). The value in the JSON payload is not a valid number — an internal data-quality issue in the payload sent from the page.

Solutions

  1. Update k6 in case of a web-vitals script bug
  2. Report to grafana/k6 with the offending value shown in the error
  3. Retry the run; transient bad payloads are rare
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/frame_session.go:365 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@3fcf5388d7 (2026-08-18). Data as JSON: /api/errors/7c1f170fe7ce830e. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/frame_session.go:396

		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)

	// Buffer the latest value for this page and metric instead of emitting it
	// immediately. The buffer is flushed once per page so each page contributes
	// a single sample per metric.
	fs.bufferedWebVitalsMu.Lock()
	fs.bufferedWebVitals[webVitalKey{url: wv.URL, name: wv.Name}] = webVitalSample{
		sample: k6metrics.Sample{
			TimeSeries: k6metrics.TimeSeries{Metric: metric, Tags: tags},
			Value:      value,

View on GitHub (pinned to 3fcf5388d7)