{"record":{"id":"8b5662c8e25661d7","repo":"Hmbown/CodeWhale","slug":"http-and-mobile-are-mutually-exclusive-choose","errorCode":null,"errorMessage":"--http and --mobile are mutually exclusive; choose one","messagePattern":"--http and --mobile are mutually exclusive; choose one","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":1284,"sourceCode":"            host,\n            mobile_rebound_to_lan: false,\n        },\n        (false, None) => ServeBindHost {\n            host: \"127.0.0.1\".to_string(),\n            mobile_rebound_to_lan: false,\n        },\n    }\n}\n\nfn validate_serve_mode_selection(\n    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","sourceCodeStart":1266,"sourceCodeEnd":1302,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/lib.rs#L1266-L1302","documentation":"validate_serve_mode_selection enforces the serve flag matrix before any server starts. --http and --mobile both select the HTTP server but with different bind defaults (--mobile rebinds to 0.0.0.0 for LAN reachability), so passing both is ambiguous and rejected outright; exactly one transport mode must be chosen.","triggerScenarios":"`codewhale serve --http --mobile` (or any wrapper/script that concatenates both flags); copy-pasted command lines from docs that combine the two; CI matrices that set both flags when only one was intended.","commonSituations":"Migrating a command from --http to --mobile and leaving the old flag in place; shell scripts building flags conditionally where both conditions evaluate true.","solutions":["Pick one: `--http` for loopback-only API server, `--mobile` for the LAN-reachable mobile control page","If you copied the command, delete the stale flag","Audit wrapper scripts that OR several serve flags together"],"exampleFix":"# before\ncodewhale serve --http --mobile\n\n# after\ncodewhale serve --mobile        # or: codewhale serve --http","handlingStrategy":"validation","validationCode":"# Assert at most one HTTP flavor before serving\nflags=()\n$HTTP  && flags+=(--http)\n$MOBILE && flags+=(--mobile)\n[ \"${#flags[@]}\" -gt 1 ] && { echo 'pick one of --http/--mobile'; exit 2; }\ncodewhale serve \"${flags[@]}\"","typeGuard":"fn http_flavor_unique(http: bool, mobile: bool) -> bool {\n    !(http && mobile)\n}","tryCatchPattern":null,"preventionTips":["Model serve mode as a single enum in wrappers, not independent booleans","Reject flag combinations at script start rather than letting the CLI fail late"],"tags":["serve","cli","flags","mutual-exclusion"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}