{"record":{"id":"b002d261e55629e4","repo":"grafana/k6","slug":"error-saving-summary-to-s-after-d-bytes-w","errorCode":null,"errorMessage":"error saving summary to '%s' after %d bytes: %w","messagePattern":"error saving summary to '(.+?)' after (.+?) bytes: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/run.go","lineNumber":609,"sourceCode":"func handleSummaryResult(fs fsext.Fs, stdOut, stdErr io.Writer, result map[string]io.Reader) error {\n\tvar errs []error\n\n\tgetWriter := func(path string) (io.Writer, error) {\n\t\tswitch path {\n\t\tcase \"stdout\":\n\t\t\treturn stdOut, nil\n\t\tcase \"stderr\":\n\t\t\treturn stdErr, nil\n\t\tdefault:\n\t\t\treturn fs.OpenFile(path, syscall.O_WRONLY|syscall.O_CREAT|syscall.O_TRUNC, 0o666)\n\t\t}\n\t}\n\n\tfor path, value := range result {\n\t\tif writer, err := getWriter(path); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"could not open '%s': %w\", path, err))\n\t\t} else if n, err := io.Copy(writer, value); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"error saving summary to '%s' after %d bytes: %w\", path, n, err))\n\t\t}\n\t}\n\n\treturn consolidateErrorMessage(errs, \"Could not save some summary information:\")\n}\n","sourceCodeStart":591,"sourceCodeEnd":615,"githubUrl":"https://github.com/grafana/k6/blob/3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee/internal/cmd/run.go#L591-L615","documentation":"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:'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Free disk space or raise the quota, then rerun the test","Write the summary to 'stdout' and redirect to a roomier mount: k6 run script.js > summary.txt","Reduce summary size: limit summaryTrendStats, trim tags/options that explode metric cardinality"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# check free space before a run that writes big summaries\navail_kb=$(df -Pk . | awk 'NR==2 {print $4}')\nif [ \"${avail_kb:-0}\" -lt 102400 ]; then\n  echo \"less than 100MB free — summary writes may fail\" >&2; exit 1\nfi\nk6 run script.js","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give CI containers enough disk for the largest expected summary, with headroom","Trim summary size via options.summaryTrendStats and restrained tag usage to bound output size","Write summaries to stdout and let the runner's artifact system persist them when disk is tight"],"tags":["k6","summary","file-io","disk-full","io"],"backgroundTag":"disk-write-failure","analyzedSha":"3fcf5388d78cb382f0c0d42ec556a06bfd1b8dee","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}