grafana/k6 · error

error handling summary object %s: %w

Error message

error handling summary object %s: %w

What it means

One entry of the object returned by handleSummary has a value that common.GetReader cannot convert to an io.Reader. Each value in the map must be a string, an object serializable to JSON, or otherwise readable; values such as functions, undefined, or exotic objects make GetReader fail, and the error names the offending destination key.

Source

Thrown at internal/js/summary.go:223

		"checks": checks,
	}
}

func getSummaryResult(rawResult sobek.Value) (map[string]io.Reader, error) {
	if common.IsNullish(rawResult) {
		return nil, nil //nolint:nilnil // this is actually valid result in this case
	}

	rawResultMap, ok := rawResult.Export().(map[string]any)
	if !ok {
		return nil, fmt.Errorf("handleSummary() should return a map with string keys")
	}

	results := make(map[string]io.Reader, len(rawResultMap))
	for path, val := range rawResultMap {
		readerVal, err := common.GetReader(val)
		if err != nil {
			return nil, fmt.Errorf("error handling summary object %s: %w", path, err)
		}
		results[path] = readerVal
	}

	return results, nil
}

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Make every value in the returned map a string or a JSON-safe object (e.g. JSON.stringify(data) or the textSummary helper output)
  2. Identify the failing destination from the error message and inspect that key's value
  3. Do not return functions, Symbols, or class instances as summary payloads
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/summary.go:223 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/009fb769ff1aae79. Report an issue: GitHub.