{"record":{"id":"25a6fd3c66775fbf","repo":"facebook/flow","slug":"failed-to-flush-spinner-status","errorCode":null,"errorMessage":"failed to flush spinner status","messagePattern":"failed to flush spinner status","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust_port/crates/flow_cli/src/command_utils.rs","lineNumber":3008,"sourceCode":"                stream,\n                bincode::config::legacy()\n                    .with_limit::<{ flow_commands_connect::command_connect_simple::MAX_FRAME_BYTES }>(),\n            )\n        })?;\n        Ok(())\n    }\n\n    fn eprintf_with_spinner(msg: &str) {\n        let stderr = std::io::stderr();\n        let mut stderr = stderr.lock();\n        if stderr.is_terminal() {\n            if flow_utils_tty::spinner_used() {\n                flow_utils_tty::print_clear_line(&mut stderr)\n                    .expect(\"failed to clear spinner line\");\n            }\n            write!(stderr, \"{}: {}\", msg, flow_utils_tty::spinner(false))\n                .expect(\"failed to write spinner status\");\n            stderr.flush().expect(\"failed to flush spinner status\");\n        } else {\n            writeln!(stderr, \"{}\", msg).expect(\"failed to write spinner status\");\n            stderr.flush().expect(\"failed to flush spinner status\");\n        }\n    }\n\n    // Waits for a response over the socket. If the connection dies, this will throw an exception\n    fn wait_for_response(\n        stream: &mut flow_common_socket::socket::SocketStream,\n        quiet: bool,\n        emoji: bool,\n        _root: &std::path::Path,\n    ) -> Result<server_prot::response::Response, ()> {\n        let use_emoji = flow_utils_tty::supports_emoji() && emoji;\n        stream.set_read_timeout(None).map_err(|_| ())?;\n        loop {\n            let response: Result<MonitorToClientMessage, _> =\n                flow_parser::loc::with_full_source_serde(|| {","sourceCodeStart":2990,"sourceCodeEnd":3026,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_cli/src/command_utils.rs#L2990-L3026","documentation":"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.","triggerScenarios":"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.","commonSituations":"Flaky ssh connections during long checks; CI pty harnesses closing early; terminal emulator crashes.","solutions":["Redirect stderr to a file for any detached or flaky-session run: `flow ... 2>flow.log`","Re-attach or restart the session and re-run","Maintainer: ignore flush errors on the status path (`let _ = stderr.flush();`) — progress output is non-critical"],"exampleFix":"// before\nstderr.flush().expect(\"failed to flush spinner status\");\n\n// after\n// progress output is non-critical; a dead tty must not crash the CLI\nlet _ = stderr.flush();","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// A failed flush of a progress line is never fatal\nlet _ = stderr.flush();","preventionTips":["Redirect stderr to a file for detached or flaky-session runs","Re-attach or restart sessions and re-run rather than letting processes write to dead ptys","Make flush failures on UI paths non-fatal in code you control"],"tags":["rust","flow-cli","stderr","tty","eio","flush","panic"],"backgroundTag":"stderr-write-failure","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}