Hmbown/CodeWhale · error

--continue/--resume/--session-id apply to the interactive…

Error message

--continue/--resume/--session-id apply to the interactive session and cannot be combined with a subcommand. Run them without a subcommand, or use the subcommand's own flag (for example `codewhale exec --session-id <id>`).

What it means

Session-selection flags `--continue`, `--resume`, and `--session-id` belong to the interactive TUI session only. The dispatcher bails when any subcommand is present AND any of these flags is set, because no subcommand handler reads them — accepting silently would start a fresh session while looking like a resumed one. The message points users at the subcommand's own flags.

Solutions

  1. Run the interactive resume without a subcommand: `codewhale --resume abc` (or `--continue`).
  2. Use the subcommand's own session flag: `codewhale exec --session-id <id>` or `codewhale exec --resume <id> <PROMPT>`.
  3. If the script must support both modes, branch: pass session flags only when no subcommand is used.

Example fix

// before
codewhale --resume abc exec "summarize"
// error: --continue/--resume/--session-id apply to the interactive session...

// after
codewhale exec --resume abc "summarize"
Defensive patterns

Strategy: validation

Validate before calling

# wrapper guard
has_sub=false; for a in "$@"; do case "$a" in exec|mcp|auth|app-server|config|workflow) has_sub=true;; esac; done
if $has_sub; then
  case "$*" in *--continue*|*--resume*|*--session-id*) echo "use the subcommand's own session flag"; exit 2;; esac
fi

Try / catch

match run(args) {
    Err(e) if e.to_string().contains("apply to the interactive session") => {
        eprintln!("move session flags under the subcommand or run interactively");
    }
    r => r?,
}

Prevention

When it happens

Trigger: Invocations like `codewhale --resume abc exec "..."`, `codewhale --continue mcp ...`, or `codewhale --session-id X app-server` — any subcommand combined with one of the three session flags.

Common situations: Wrapping scripts that prepend session flags to a base command, users expecting global flags to flow into subcommands, or copying an interactive invocation and appending a subcommand.

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/ec342f0c202e2198. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/lib.rs:2013

    let cwd = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
    let config_path =
        config_store_path_for_dispatch(cli.config.clone(), project_bundle_scope, &cwd);
    let mut store = ConfigStore::load(config_path).map_err(|error| {
        if pipe_api_key_handoff {
            anyhow!("unavailable credential")
        } else {
            error
        }
    })?;
    // Root session flags only reach the TUI through the `None` branch below;
    // no subcommand handler reads them. Accepting them silently resumes
    // nothing -- `codewhale --resume abc exec "..."` would start a fresh
    // session while looking like it continued one.
    if command.is_some()
        && (cli.continue_session || cli.resume.is_some() || cli.session_id.is_some())
    {
        anyhow::bail!(
            "--continue/--resume/--session-id apply to the interactive session and \
             cannot be combined with a subcommand. Run them without a subcommand, or \
             use the subcommand's own flag (for example `codewhale exec --session-id <id>`)."
        );
    }
    // Only config inspection needs the store overlay. Runtime overrides use
    // the dedicated flags above and must never enter a store that another
    // command (or legacy credential migration) can save.
    if matches!(command, Some(Commands::Config(_))) {
        apply_per_run_overrides(&mut store, &cli.overrides)?;
    }

    match command {
        Some(Commands::Run(args)) => {
            let resolved_runtime = resolve_runtime_for_dispatch(&mut store, &runtime_overrides);
            run_tui_in_process(&cli, &resolved_runtime, args.args)
        }
        Some(Commands::Doctor(args)) => {

View on GitHub (pinned to 73e0f67d83)