{"record":{"id":"26a762dc9aedac09","repo":"grafana/k6","slug":"could-flush-the-data-to-the-output-w","errorCode":null,"errorMessage":"could flush the data to the output: %w","messagePattern":"could flush the data to the output: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/ui.go","lineNumber":404,"sourceCode":"\t\t\t\t\ttermWidth = tw\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\trenderProgressBars(true)\n\t\tgs.OutMutex.Lock()\n\t\tprintProgressBars()\n\t\tgs.OutMutex.Unlock()\n\t}\n}\n\nfunc yamlPrint(w io.Writer, v any) error {\n\tdata, err := yaml.Marshal(v)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not marshal YAML: %w\", err)\n\t}\n\t_, err = fmt.Fprint(w, string(data))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could flush the data to the output: %w\", err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":386,"sourceCodeEnd":408,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/cmd/ui.go#L386-L408","documentation":"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.","triggerScenarios":"Thrown at internal/cmd/ui.go:404 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}