Hmbown/CodeWhale · error

--cloud is required in --non-interactive mode.

Error message

--cloud is required in --non-interactive mode. {}

What it means

`resolve_cloud` requires an explicit `--cloud` slug when running remote setup in `--non-interactive` mode, because there is no TTY to prompt for a choice. Without it the command cannot determine the cloud target and fails fast.

Solutions

  1. Add `--cloud <slug>` to the command line
  2. Run `remote_setup` without `--non-interactive` to get the interactive prompt
  3. List valid slugs by triggering the error message or checking the cloud registry docs

Example fix

// before
codewhale remote-setup --non-interactive --bridge slack
// after
codewhale remote-setup --non-interactive --cloud aws --bridge slack
Defensive patterns

Strategy: validation

Validate before calling

if [[ $CI ]] && [[ ! "$*" =~ --cloud ]]; then echo "--cloud required with --non-interactive"; exit 2; fi

Prevention

When it happens

Trigger: Calling `remote_setup` with `--non-interactive` and no `--cloud <slug>` flag, or with a `--cloud` slug unknown to the registry (which raises the sibling 'unknown cloud' error).

Common situations: Scripting/CI automation of remote setup where all interactive prompts must be satisfied by flags; forgetting the required flag in a shell script or Docker entrypoint.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/remote_setup/mod.rs:149

    use codewhale_palette as palette;
    use colored::Colorize;
    let (r, g, b) = palette::WHALE_ACTION_RGB;
    println!("{}", "Codewhale Remote Setup".truecolor(r, g, b).bold());
    println!("{}", "======================".truecolor(r, g, b));
    println!("Generate a deploy bundle for a remote Codewhale agent (cloud + chat bridge).");
}

// ---------------------------------------------------------------------------
// Resolution: flag -> prompt (unless --non-interactive) -> validated value
// ---------------------------------------------------------------------------

fn resolve_cloud(args: &RemoteSetupArgs) -> Result<&'static CloudTarget> {
    if let Some(slug) = &args.cloud {
        return registry::cloud_by_slug(slug)
            .ok_or_else(|| anyhow::anyhow!("unknown cloud '{slug}'. {}", cloud_choices()));
    }
    if args.non_interactive {
        bail!(
            "--cloud is required in --non-interactive mode. {}",
            cloud_choices()
        );
    }
    let idx = prompt_choice(
        "Cloud target",
        &CLOUD_TARGETS
            .iter()
            .map(|c| format!("{} ({})", c.display, c.slug))
            .collect::<Vec<_>>(),
    )?;
    Ok(&CLOUD_TARGETS[idx])
}

fn resolve_bridge(args: &RemoteSetupArgs) -> Result<&'static BridgeSpec> {
    if let Some(slug) = &args.bridge {
        return registry::bridge_by_slug(slug)
            .ok_or_else(|| anyhow::anyhow!("unknown bridge '{slug}'. {}", bridge_choices()));

View on GitHub (pinned to 73e0f67d83)