Hmbown/CodeWhale · error · anyhow::Error

--http and --mobile are mutually exclusive; choose one

Error message

--http and --mobile are mutually exclusive; choose one

What it means

Server-mode selection validates flag combinations before starting any server. Passing both `--http` and `--mobile` is rejected up front because they select overlapping but distinct HTTP-serving modes and only one serving mode may be chosen.

Solutions

  1. Pass only one of --http or --mobile
  2. If mobile support was intended, use --mobile alone (it implies the HTTP mode path)
  3. Review the script/alias that concatenates flags and drop the duplicate

Example fix

// before
codewhale serve --http --mobile
// after
codewhale serve --mobile
Defensive patterns

Strategy: validation

Validate before calling

if http && mobile { eprintln!("choose one of --http/--mobile"); std::process::exit(2); }

Try / catch

match result { Err(e) if e.to_string().contains("mutually exclusive") => { eprintln!("{}", e); std::process::exit(2); }, other => other? }

Prevention

When it happens

Trigger: Invoking a serve/server subcommand with both `--http` and `--mobile` set (e.g. `codewhale serve --http --mobile`).

Common situations: Copy-pasting two example command lines together; scripting that always appends both flags; misunderstanding --mobile as a modifier of --http rather than an alternative.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/8b5662c8e25661d7. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/lib.rs:1401

struct ServeBindHost {
    host: String,
}

fn resolve_serve_bind_host(_mobile: bool, host: Option<String>) -> ServeBindHost {
    ServeBindHost {
        host: host.unwrap_or_else(|| "127.0.0.1".to_string()),
    }
}

fn validate_serve_mode_selection(
    mcp: bool,
    http: bool,
    mobile: bool,
    web: bool,
    acp: bool,
) -> Result<bool> {
    if http && mobile {
        bail!("--http and --mobile are mutually exclusive; choose one");
    }
    if web && (http || mobile) {
        bail!("--web is mutually exclusive with --http and --mobile");
    }
    let http_selected = http || mobile || web;
    let selected_modes = [mcp, http_selected, acp]
        .into_iter()
        .filter(|selected| *selected)
        .count();
    if selected_modes != 1 {
        bail!("Choose exactly one server mode: --mcp, --http/--mobile/--web, or --acp");
    }
    Ok(http_selected)
}

#[derive(Subcommand, Debug, Clone)]
enum McpCommand {
    /// List configured MCP servers

View on GitHub (pinned to 73e0f67d83)