{"record":{"id":"cf41de69f36c110b","repo":"astrid-runtime/astrid","slug":"mcp-gateway-attach-is-only-supported-on-unix-hosts","errorCode":null,"errorMessage":"MCP gateway attach is only supported on Unix hosts","messagePattern":"MCP gateway attach is only supported on Unix hosts","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/mcp/mod.rs","lineNumber":52,"sourceCode":"//! config, so a stray diagnostic can never corrupt the protocol stream.\n\n// The persistent gateway uses Unix-domain sockets. Keep those implementations\n// out of non-Unix builds while preserving the CLI command surface with an\n// actionable unsupported-target error.\n#[cfg(unix)]\nmod attach;\n#[cfg(not(unix))]\nmod attach {\n    use std::path::Path;\n    use std::process::ExitCode;\n\n    use anyhow::Result;\n\n    pub(crate) async fn run(\n        _principal: Option<&str>,\n        _workspace: Option<&Path>,\n    ) -> Result<ExitCode> {\n        anyhow::bail!(\"MCP gateway attach is only supported on Unix hosts\")\n    }\n}\nmod elicit;\nmod form_elicitation;\n#[cfg(unix)]\nmod gateway;\n#[cfg(unix)]\nmod idle;\n#[cfg(not(unix))]\nmod gateway {\n    use std::process::ExitCode;\n\n    use anyhow::Result;\n\n    pub(crate) async fn run(_principal: Option<&str>) -> Result<ExitCode> {\n        anyhow::bail!(\"MCP gateway is only supported on Unix hosts\")\n    }\n}","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/mcp/mod.rs#L34-L70","documentation":"`astrid mcp attach` is implemented only for Unix hosts, where the gateway multiplexes over Unix domain sockets. On non-Unix targets (e.g. Windows) a stub `gateway::run` is compiled in that unconditionally fails with this error.","triggerScenarios":"Invoking `astrid mcp attach` (the run in the non-unix stub of crates/astrid-cli/src/commands/mcp/mod.rs) on a non-Unix platform such as Windows.","commonSituations":"Running the astrid CLI on Windows or another non-Unix OS; running in a Windows container or a target where the `#[cfg(unix)]` modules are excluded.","solutions":["Run the attach command on a Unix host (Linux or macOS).","Use WSL2 on Windows to access the Unix-only MCP gateway functionality.","Do not script attach on non-Unix hosts; gate automation on `cfg!(unix)`-equivalent checks.","If Unix support in a new environment is needed, request/implement a non-Unix transport backend."],"exampleFix":"// before (PowerShell on Windows)\nastrid mcp attach\n// after (WSL2)\nwsl astrid mcp attach","handlingStrategy":"validation","validationCode":"#[cfg(not(unix))]\ncompile_error!(\"or at runtime:\");\nif !cfg!(unix) {\n    eprintln!(\"mcp attach requires a Unix host\");\n    return;\n}","typeGuard":"fn supports_mcp_attach() -> bool { cfg!(unix) }","tryCatchPattern":"match attach().await {\n    Err(e) if e.to_string().contains(\"only supported on Unix hosts\") =>\n        eprintln!(\"rerun under Linux/macOS or WSL2\"),\n    other => other?,\n}","preventionTips":["Gate MCP automation on Unix platforms","Use WSL2 on Windows machines","Pin CI jobs that use mcp attach to Linux runners","Check cfg!(unix) before offering the command in tooling"],"tags":["platform","windows","mcp","unsupported"],"backgroundTag":"unsupported-platform","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}