{"record":{"id":"d0ddc81f90e727d0","repo":"facebook/flow","slug":"failed-to-write-spinner-status","errorCode":null,"errorMessage":"failed to write spinner status","messagePattern":"failed to write spinner status","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust_port/crates/flow_cli/src/command_utils.rs","lineNumber":3007,"sourceCode":"                &command,\n                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, _> =","sourceCodeStart":2989,"sourceCodeEnd":3025,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_cli/src/command_utils.rs#L2989-L3025","documentation":"In eprintf_with_spinner's terminal branch, after clearing the spinner line the CLI writes '<message>: <spinner-frame>' to stderr (spinner(false) returns the next ASCII spinner frame). If the terminal's pts master has closed, this write returns EIO and the .expect() panics mid-status-line, typically during server connect/retry messages.","triggerScenarios":"The controlling terminal/ssh session dies (with SIGHUP ignored or under nohup) while the CLI is printing connect progress such as 'Please hold' or retry notices; a tmux pane holding the process is killed; stderr redirected to a pts that has been recycled.","commonSituations":"Disconnecting from long-running remote checks; automation that detaches sessions mid-run; pty-based harnesses torn down early.","solutions":["Redirect stderr to a file for detached runs: `flow ... 2>flow.log &`","Run the command inside a session that stays alive (tmux attach kept open, ssh kept connected)","Maintainer: treat status-line writes as best-effort (ignore or log-and-continue on Err) instead of expect"],"exampleFix":"// before\nwrite!(stderr, \"{}: {}\", msg, flow_utils_tty::spinner(false))\n    .expect(\"failed to write spinner status\");\n\n// after\nlet _ = write!(stderr, \"{}: {}\", msg, flow_utils_tty::spinner(false));","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Progress output is best-effort; skip silently when stderr is dead\nlet _ = write!(stderr, \"{}: {}\", msg, flow_utils_tty::spinner(false));","preventionTips":["Keep the owning terminal/session alive for the whole run (tmux/ssh)","Redirect stderr to a file when detaching processes","Disable interactive progress (quiet mode) in non-interactive automation"],"tags":["rust","flow-cli","stderr","tty","eio","spinner","panic"],"backgroundTag":"stderr-write-failure","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}