facebook/flow · error
failed to write status
Error message
failed to write status
What it means
Raised by print_status when the non-spinner branch, writeln!(stderr, "{}", message), fails to write the plain status message to stderr. This branch runs whenever progress/spinner output is disabled or stderr is not a terminal, and the expect panics because the library assumes status messages can always be written. Failure indicates stderr is closed, redirected to a broken pipe, or hitting an I/O error.
Source
Thrown at rust_port/crates/flow_commands_connect/src/command_connect.rs:52
pub emoji: bool,
pub quiet: bool,
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 startView on GitHub (pinned to 5c86586199)
Solutions
- Redirect stderr to a writable target (file or live terminal) and rerun.
- Free disk space if stderr is a log file on a full filesystem.
- Stop piping stderr into consumers that terminate before the command completes.
- Patch the library to tolerate stderr write failures (log-and-continue) if you control the code.
Example fix
// invocation, before flow check 2>&1 | head -n 5 // after flow check 2>flow-check.log; head -n 5 flow-check.log
Defensive patterns
Strategy: try-catch
Validate before calling
use std::io::Write;
fn stderr_writable() -> bool {
let mut e = std::io::stderr();
e.write_all(b"").and_then(|_| e.flush()).is_ok()
}
// call before invoking; skip/redirect if false Type guard
fn stderr_alive() -> bool { stderr_writable() } Try / catch
match std::panic::catch_unwind(|| connect_flow()) {
Ok(r) => r,
Err(_) => { let _ = std::fs::write("flow-status-fallback.log", "status write failed"); std::process::exit(1); }
} Prevention
- Redirect stderr to disk with adequate free space in CI.
- Never close fd 2 in wrapper scripts around flow commands.
- Avoid `| head` style pipelines on stderr.
- Guard long-running jobs with logrotate instead of deleting open log files.
When it happens
Trigger: connect_rec or handle_missing_server calls print_status with show_progress off (or stderr not a TTY) while stderr's writer is gone: closed fd 2, piped into a terminated consumer, or disk full when stderr points to a file.
Common situations: CI jobs where stderr is redirected to a log file on a full disk; running under wrappers that close stderr; piping output to `head`/`grep -q` that exits early; backgrounding the process with stderr attached to a dead terminal.
Related errors
- failed to write spinner status
- failed to flush status
- failed to clear spinner line
- failed to write spinner status
- failed to flush spinner status
AI-assisted analysis of facebook/flow@5c86586199 (2026-09-08).
Data as JSON: /api/errors/f81855419a835301.
Report an issue: GitHub.