facebook/flow · error
failed to flush status
Error message
failed to flush status
What it means
Raised by print_status when stderr.flush() fails after writing the status message. The write may have been buffered by the locked StderrLock, and the flush surfaces any deferred I/O error (EPIPE, ENOSPC, closed descriptor). The expect panics because a failed flush means the status output was not actually delivered.
Source
Thrown at rust_port/crates/flow_commands_connect/src/command_connect.rs:54
pub show_progress: bool,
pub flowconfig_name: &'a str,
pub rerun_on_mismatch: bool,
}
fn print_status(env: &Env<'_>, message: &str) {
if env.quiet {
return;
}
let stderr = std::io::stderr();
let mut stderr = stderr.lock();
if env.show_progress && stderr.is_terminal() {
write!(stderr, "{}: {}", message, flow_utils_tty::spinner(false))
.expect("failed to write spinner status");
} else {
writeln!(stderr, "{}", message).expect("failed to write status");
}
stderr.flush().expect("failed to flush status");
}
fn arg(name: &str, value: Option<&str>, arr: &mut Vec<String>) {
if let Some(value) = value {
arr.push(name.to_string());
arr.push(value.to_string());
}
}
fn flag(name: &str, value: bool, arr: &mut Vec<String>) {
if value {
arr.push(name.to_string());
}
}
// Starts up a flow server by literally calling flow start
fn start_flow_server(env: &Env) -> Result<(), (String, flow_common_exit_status::FlowExitStatus)> {
let Env {View on GitHub (pinned to 5c86586199)
Solutions
- Reattach to a valid stderr (live terminal or writable file) and rerun the command.
- Check and free disk space if stderr is file-redirected.
- Ignore the broken output stream by rerunning with --quiet / progress disabled.
- Change the library to treat flush errors as non-fatal (best-effort logging).
Example fix
// before
stderr.flush().expect("failed to flush status");
// after
let _ = stderr.flush(); // best-effort; status output is not critical Defensive patterns
Strategy: try-catch
Validate before calling
use std::io::Write;
fn flush_ok() -> bool { std::io::stderr().flush().is_ok() } Type guard
fn stderr_flushable() -> bool {
use std::io::Write;
std::io::stderr().flush().is_ok()
} Try / catch
let result = std::panic::catch_unwind(run_connect);
if result.is_err() {
eprintln!("flush failed mid-run: check stderr target (EPIPE/ENOSPC)");
} Prevention
- Monitor free disk space where stderr logs are written.
- Keep terminal/SSH sessions alive for interactive runs.
- Treat stderr as best-effort: redirect important output to stdout/files.
- Patch print_status-style helpers to ignore flush errors rather than panic.
When it happens
Trigger: connect_rec or handle_missing_server calls print_status; the writeln! succeeds into the buffer, but flushing to the underlying stderr descriptor fails — typically broken pipe on a detached terminal or ENOSPC on a redirected log file.
Common situations: Long-running connect loops where the terminal/SSH session dies mid-run; stderr redirected to a filesystem that fills up during the run; container runtimes that close the log stream.
Related errors
- failed to flush spinner status
- failed to write spinner status
- failed to write status
- failed to flush cli errors
- failed to clear spinner line
AI-assisted analysis of facebook/flow@5c86586199 (2026-09-08).
Data as JSON: /api/errors/7222c85649642200.
Report an issue: GitHub.