grafana/k6 · error

value couldn't be parsed %q

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.

Source

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

		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{
			{
				TimeSeries: k6metrics.TimeSeries{Metric: metric, Tags: tags},
				Value:      value,
				Time:       now,
			},

View on GitHub (pinned to 94169daab2)

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@94169daab2 (2026-08-18). Data as JSON: /api/errors/7c1f170fe7ce830e. Report an issue: GitHub.