{"record":{"id":"0d35836cf460cef8","repo":"Hmbown/CodeWhale","slug":"choose-exactly-one-server-mode-mcp-http-mo","errorCode":null,"errorMessage":"Choose exactly one server mode: --mcp, --http/--mobile/--web, or --acp","messagePattern":"Choose exactly one server mode: --mcp, --http/--mobile/--web, or --acp","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":1412,"sourceCode":"    mcp: bool,\n    http: bool,\n    mobile: bool,\n    web: bool,\n    acp: bool,\n) -> Result<bool> {\n    if http && mobile {\n        bail!(\"--http and --mobile are mutually exclusive; choose one\");\n    }\n    if web && (http || mobile) {\n        bail!(\"--web is mutually exclusive with --http and --mobile\");\n    }\n    let http_selected = http || mobile || web;\n    let selected_modes = [mcp, http_selected, acp]\n        .into_iter()\n        .filter(|selected| *selected)\n        .count();\n    if selected_modes != 1 {\n        bail!(\"Choose exactly one server mode: --mcp, --http/--mobile/--web, or --acp\");\n    }\n    Ok(http_selected)\n}\n\n#[derive(Subcommand, Debug, Clone)]\nenum McpCommand {\n    /// List configured MCP servers\n    List,\n    /// Create a template MCP config at the configured path\n    Init {\n        /// Overwrite an existing MCP config file\n        #[arg(long, default_value_t = false)]\n        force: bool,\n    },\n    /// Connect to MCP servers and report status\n    Connect {\n        /// Optional server name to connect to\n        #[arg(value_name = \"SERVER\")]","sourceCodeStart":1394,"sourceCodeEnd":1430,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L1394-L1430","documentation":"Exactly one server mode must be selected: MCP, the HTTP family (--http/--mobile/--web), or ACP. The validator counts the selected modes and bails when the count is not exactly 1 — covering zero modes selected or multiple selected.","triggerScenarios":"Running a serve/server subcommand with no mode flag at all (count 0), or with two or more of --mcp, --http/--mobile/--web, --acp (count >= 2).","commonSituations":"Forgetting to pass any server-mode flag in a script; adding --mcp on top of --http; copy-paste errors combining flags from different examples.","solutions":["Pass exactly one of: --mcp, --http (or --mobile/--web), --acp","If no mode was intended, check the script — the command cannot start a server without one mode","Remove extra mode flags until only one remains"],"exampleFix":"// before\ncodewhale serve --mcp --acp\n// after\ncodewhale serve --mcp","handlingStrategy":"validation","validationCode":"let modes = [mcp, http || mobile || web, acp].iter().filter(|b| **b).count();\nif modes != 1 { eprintln!(\"select exactly one server mode\"); std::process::exit(2); }","typeGuard":null,"tryCatchPattern":"match result { Err(e) if e.to_string().contains(\"Choose exactly one server mode\") => { eprintln!(\"{}\", e); std::process::exit(2); }, other => other? }","preventionTips":["Always pass one explicit server-mode flag in scripts","Fail fast in wrappers when zero or multiple modes are configured","Document the chosen mode per deployment script"],"tags":["cli","flags","server"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}