{"record":{"id":"e2a99f9f2459e29e","repo":"facebook/flow","slug":"error-sending-command-to-server","errorCode":null,"errorMessage":"Error sending command to server: {}","messagePattern":"Error sending command to server: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust_port/crates/flow_cli/src/command_utils.rs","lineNumber":3187,"sourceCode":"        Ok(()) => wait_for_response(&mut stream, quiet, env.emoji, root),\n        Err(bincode::error::EncodeError::Io { inner, .. })\n            if matches!(\n                inner.kind(),\n                std::io::ErrorKind::BrokenPipe\n                    | std::io::ErrorKind::ConnectionReset\n                    | std::io::ErrorKind::UnexpectedEof\n            ) =>\n        {\n            if !quiet && flow_utils_tty::spinner_used() {\n                let stderr = std::io::stderr();\n                let mut stderr = stderr.lock();\n                flow_utils_tty::print_clear_line(&mut stderr)\n                    .expect(\"failed to clear spinner line\");\n            }\n            Err(())\n        }\n        Err(e) => {\n            panic!(\"Error sending command to server: {}\", e);\n        }\n    };\n\n    match response {\n        Ok(response) => response,\n        Err(()) => {\n            flow_commands_connect::command_connect_simple::close_connection(&sockaddr);\n            if !quiet {\n                eprintf_with_spinner(&format!(\n                    \"Lost connection to the flow server ({} {} remaining)\",\n                    retries,\n                    if retries == 1 { \"retry\" } else { \"retries\" },\n                ));\n            }\n            connect_and_make_request_inner(\n                flowconfig_name,\n                connect_flags,\n                root,","sourceCodeStart":3169,"sourceCodeEnd":3205,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_cli/src/command_utils.rs#L3169-L3205","documentation":"While sending a command to the flow server, the client tolerates expected disconnect error kinds (the match arm covering UnexpectedEof and friends clears the spinner and yields Err(()), which drives the 'Lost connection to the flow server (N retries remaining)' retry path). Any other send error is not retried and panics with the underlying io error.","triggerScenarios":"Sending the serialized command to the server socket fails with an error kind outside the handled set: server dies before reading the request, socket torn down abnormally, or an OS-level send failure other than the recognized EOF/connection kinds.","commonSituations":"Server process killed (OOM, signal) right as the client sends a command; mismatched client/server versions sharing a daemon; flaky network filesystem or container runtime killing sockets; heavy load causing the server to close connections abruptly.","solutions":["Rerun the command; the retry path usually reconnects once the server is restarted","Run flow stop to clear any half-dead daemon, then retry","Verify client and server come from the same flow version and installation","Investigate server-side crashes (logs, dmesg/OOM) if sends repeatedly fail"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Rerun the command when a server dies mid-send; the built-in retry path needs a healthy server","Pin client and server to the same flow build in CI and on dev machines","Avoid killing the flow server while commands are in flight"],"tags":["client-server","socket","send","panic","flow-server"],"backgroundTag":"broken-pipe","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}