grafana/k6 · error
could flush the data to the output
Error message
could flush the data to the output: %w
What it means
yamlPrint wraps fmt.Fprint failing while writing marshaled YAML to the writer (typically stdout being closed or a broken pipe, e.g. piping k6 output to head). An I/O failure, not a data problem.
Solutions
- Ensure the output stream is open and writable
- If piping k6 output to another command, make sure that command keeps reading (avoid early-exit tools like head without -n)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/cmd/ui.go:404 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/26a762dc9aedac09.
Report an issue: GitHub.
Appendix: source
Thrown at internal/cmd/ui.go:404
termWidth = tw
}
}
}
renderProgressBars(true)
gs.OutMutex.Lock()
printProgressBars()
gs.OutMutex.Unlock()
}
}
func yamlPrint(w io.Writer, v any) error {
data, err := yaml.Marshal(v)
if err != nil {
return fmt.Errorf("could not marshal YAML: %w", err)
}
_, err = fmt.Fprint(w, string(data))
if err != nil {
return fmt.Errorf("could flush the data to the output: %w", err)
}
return nil
}
View on GitHub (pinned to 01ffac6f24)