{"record":{"id":"4b2b5b271e6c5149","repo":"Hmbown/CodeWhale","slug":"mcp-server-server-name-has-no-command-configur","errorCode":null,"errorMessage":"MCP server '{server_name}' has no command configured","messagePattern":"MCP server '(.+?)' has no command configured","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/mcp/src/stdio_client.rs","lineNumber":94,"sourceCode":"impl ChildProcessMcpClient {\n    /// Spawn `config.command` with `config.args`/`config.env` and complete the\n    /// MCP handshake.\n    ///\n    /// Returns `Err` — never a degraded-but-usable client — when the command\n    /// cannot be executed, exits immediately, or does not answer `initialize`\n    /// within `HANDSHAKE_TIMEOUT`.\n    pub fn spawn(config: &McpServerConfig) -> Result<Self> {\n        Self::spawn_with_timeouts(config, HANDSHAKE_TIMEOUT, REQUEST_TIMEOUT)\n    }\n\n    fn spawn_with_timeouts(\n        config: &McpServerConfig,\n        handshake_timeout: Duration,\n        request_timeout: Duration,\n    ) -> Result<Self> {\n        let server_name = config.name.clone();\n        if config.command.trim().is_empty() {\n            bail!(\"MCP server '{server_name}' has no command configured\");\n        }\n\n        let mut command = Command::new(&config.command);\n        command\n            .args(&config.args)\n            .envs(&config.env)\n            .stdin(Stdio::piped())\n            .stdout(Stdio::piped())\n            // The child's diagnostics belong on our stderr: stdout is the\n            // JSON-RPC channel and must not be polluted, and swallowing the\n            // child's stderr is how a misconfigured server becomes a silent\n            // one.\n            .stderr(Stdio::inherit());\n\n        let mut child = command.spawn().with_context(|| {\n            format!(\n                \"MCP server '{server_name}': failed to spawn command '{}'\",\n                config.command","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/mcp/src/stdio_client.rs#L76-L112","documentation":"StdioMcpClient::spawn() refuses to start an MCP server whose McpServerConfig.command is empty or only whitespace. The command is the executable that will be spawned over stdio JSON-RPC, so an empty value would only produce a confusing OS-level spawn failure later; the crate fails fast with the server name attached.","triggerScenarios":"A config entry with an empty \"command\" string; a JSON/TOML key typo (e.g. \"cmd\" or \"executable\") that deserializes command to its empty default; a command built from an env var (e.g. ${MCP_SERVER_BIN}) that is unset, leaving an empty string; a trimmed string of spaces.","commonSituations":"Hand-edited MCP config files; CI environments missing the env var that supplies the command; config schemas that accept unknown keys silently instead of rejecting them.","solutions":["Set command to the actual executable path in the server's config entry","Validate configs before spawn: reject entries whose command trims to empty at load time, listing the offending server name","If the command comes from an env var, verify the var is set in the environment that spawns the process","Check for key typos against the McpServerConfig field names so the command is not silently defaulted"],"exampleFix":"// before\nlet config = McpServerConfig {\n    name: \"github\".into(),\n    command: std::env::var(\"MCP_GITHUB_BIN\").unwrap_or_default(), // '' when unset\n    ..Default::default()\n};\nlet client = StdioMcpClient::spawn(&config)?;\n\n// after\nlet command = std::env::var(\"MCP_GITHUB_BIN\")\n    .context(\"MCP_GITHUB_BIN must point at the github MCP server executable\")?;\nlet config = McpServerConfig {\n    name: \"github\".into(),\n    command,\n    ..Default::default()\n};\nlet client = StdioMcpClient::spawn(&config)?;","handlingStrategy":"validation","validationCode":"for server in &config.servers {\n    if server.command.trim().is_empty() {\n        bail!(\"server '{}' has no command configured\", server.name);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reject empty commands at config load with the server name, before any spawn","Fail deserialization on unknown keys so typos like 'cmd' surface immediately","Resolve env-var-backed commands explicitly and error when the variable is unset"],"tags":["mcp","configuration","spawn","empty-command","stdio"],"backgroundTag":"missing-command-configuration","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}