grafana/k6 · error

error saving summary to

Error message

error saving summary to '%s' after %d bytes: %w

What it means

The summary destination file was opened successfully, but io.Copy from the rendered summary data to the writer failed partway through; the message reports how many bytes made it before the error. Typical causes are ENOSPC (disk full), quota exceeded, or the destination (network/FUSE mount, pipe) closing mid-write. All such errors are consolidated under 'Could not save some summary information:'.

Solutions

  1. Free disk space or raise the quota, then rerun the test
  2. Write the summary to 'stdout' and redirect to a roomier mount: k6 run script.js > summary.txt
  3. Reduce summary size: limit summaryTrendStats, trim tags/options that explode metric cardinality
Defensive patterns

Strategy: validation

Validate before calling

# check free space before a run that writes big summaries
avail_kb=$(df -Pk . | awk 'NR==2 {print $4}')
if [ "${avail_kb:-0}" -lt 102400 ]; then
  echo "less than 100MB free — summary writes may fail" >&2; exit 1
fi
k6 run script.js

Prevention

When it happens

Trigger: handleSummary writing a large HTML/JSON report to a full disk; writing to an NFS/FUSE mount that drops; a very large data.metrics tree serialized on long soak tests.

Common situations: Small CI containers with tight disk quotas; long-running tests whose summaries grow with unique tag combinations; writing reports to a volume that fills during the run.

Related errors


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

Appendix: source

Thrown at internal/cmd/run.go:609

func handleSummaryResult(fs fsext.Fs, stdOut, stdErr io.Writer, result map[string]io.Reader) error {
	var errs []error

	getWriter := func(path string) (io.Writer, error) {
		switch path {
		case "stdout":
			return stdOut, nil
		case "stderr":
			return stdErr, nil
		default:
			return fs.OpenFile(path, syscall.O_WRONLY|syscall.O_CREAT|syscall.O_TRUNC, 0o666)
		}
	}

	for path, value := range result {
		if writer, err := getWriter(path); err != nil {
			errs = append(errs, fmt.Errorf("could not open '%s': %w", path, err))
		} else if n, err := io.Copy(writer, value); err != nil {
			errs = append(errs, fmt.Errorf("error saving summary to '%s' after %d bytes: %w", path, n, err))
		}
	}

	return consolidateErrorMessage(errs, "Could not save some summary information:")
}

View on GitHub (pinned to 3fcf5388d7)