facebook/flow · error

failed to flush spinner status

Error message

failed to flush spinner status

What it means

Terminal-branch flush in eprintf_with_spinner: after writing the status line and spinner frame to stderr, the explicit flush pushes the bytes to the terminal. If the pts master closed between the write and the flush (or the write buffered successfully while the device died), the flush returns EIO and the .expect() panics.

Source

Thrown at rust_port/crates/flow_cli/src/command_utils.rs:3008

                stream,
                bincode::config::legacy()
                    .with_limit::<{ flow_commands_connect::command_connect_simple::MAX_FRAME_BYTES }>(),
            )
        })?;
        Ok(())
    }

    fn eprintf_with_spinner(msg: &str) {
        let stderr = std::io::stderr();
        let mut stderr = stderr.lock();
        if stderr.is_terminal() {
            if flow_utils_tty::spinner_used() {
                flow_utils_tty::print_clear_line(&mut stderr)
                    .expect("failed to clear spinner line");
            }
            write!(stderr, "{}: {}", msg, flow_utils_tty::spinner(false))
                .expect("failed to write spinner status");
            stderr.flush().expect("failed to flush spinner status");
        } else {
            writeln!(stderr, "{}", msg).expect("failed to write spinner status");
            stderr.flush().expect("failed to flush spinner status");
        }
    }

    // Waits for a response over the socket. If the connection dies, this will throw an exception
    fn wait_for_response(
        stream: &mut flow_common_socket::socket::SocketStream,
        quiet: bool,
        emoji: bool,
        _root: &std::path::Path,
    ) -> Result<server_prot::response::Response, ()> {
        let use_emoji = flow_utils_tty::supports_emoji() && emoji;
        stream.set_read_timeout(None).map_err(|_| ())?;
        loop {
            let response: Result<MonitorToClientMessage, _> =
                flow_parser::loc::with_full_source_serde(|| {

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. Redirect stderr to a file for any detached or flaky-session run: `flow ... 2>flow.log`
  2. Re-attach or restart the session and re-run
  3. Maintainer: ignore flush errors on the status path (`let _ = stderr.flush();`) — progress output is non-critical

Example fix

// before
stderr.flush().expect("failed to flush spinner status");

// after
// progress output is non-critical; a dead tty must not crash the CLI
let _ = stderr.flush();
Defensive patterns

Strategy: fallback

Try / catch

// A failed flush of a progress line is never fatal
let _ = stderr.flush();

Prevention

When it happens

Trigger: Terminal/ssh session drops right as a connect-status line is flushed under nohup/disown; pty wrapper exits between the buffered write and the flush; dead pts reaped while the CLI is mid-message.

Common situations: Flaky ssh connections during long checks; CI pty harnesses closing early; terminal emulator crashes.

Related errors


AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20). Data as JSON: /api/errors/25a6fd3c66775fbf. Report an issue: GitHub.