Hmbown/CodeWhale · error

--provider is required in --non-interactive mode. Known

Error message

--provider is required in --non-interactive mode. Known: {names_hint}

What it means

Remote setup (`resolve_provider`) needs a provider kind. If `--provider` is not supplied while `--non-interactive` is active, the function bails and lists known provider names via `ProviderKind::names_hint()`. It enforces explicit provider selection in headless mode.

Solutions

  1. Add `--provider <name>` using one of the names from the hint in the error.
  2. Run interactively (remove `--non-interactive`) to pick from the registry list.
  3. Verify provider spelling against `ProviderKind::names_hint()`.

Example fix

// before
codewhale remote-setup --non-interactive --cloud azure --bridge slack
// after
codewhale remote-setup --non-interactive --cloud azure --bridge slack --provider anthropic
Defensive patterns

Strategy: validation

Validate before calling

if (args.nonInteractive && !args.provider) throw new Error(`--provider is required in --non-interactive mode`);

Try / catch

try { runRemoteSetup(args) } catch (e) { if (String(e).includes('--provider is required')) process.exitCode = 2; else throw e; }

Prevention

When it happens

Trigger: Invoking remote setup with `--non-interactive` and no `--provider <name>`; also reached via `unknown_flags_fail_with_choices` on the non-interactive path.

Common situations: Scripted first-time setup that sets cloud and bridge but forgets the provider; CI jobs that migrated from interactive usage.

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@433685b202 (2026-09-15). Data as JSON: /api/errors/9cc6fe21d6425339. Report an issue: GitHub.

Appendix: source

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

        &BRIDGES
            .iter()
            .map(|b| format!("{} ({})", b.display, b.slug))
            .collect::<Vec<_>>(),
    )?;
    Ok(&BRIDGES[idx])
}

fn resolve_provider(args: &RemoteSetupArgs) -> Result<ProviderInfo> {
    if let Some(slug) = &args.provider {
        return ProviderInfo::from_slug(slug).ok_or_else(|| {
            anyhow::anyhow!(
                "unknown provider '{slug}'. Known: {}",
                codewhale_config::ProviderKind::names_hint()
            )
        });
    }
    if args.non_interactive {
        bail!(
            "--provider is required in --non-interactive mode. Known: {}",
            codewhale_config::ProviderKind::names_hint()
        );
    }
    // List providers by their canonical names from the existing registry.
    let providers: Vec<ProviderInfo> = codewhale_config::ProviderKind::all()
        .iter()
        .filter_map(|kind| ProviderInfo::from_slug(kind.as_str()))
        .collect();
    let labels: Vec<String> = providers
        .iter()
        .map(|p| format!("{} ({})", p.display, p.slug))
        .collect();
    let idx = prompt_choice("Model provider", &labels)?;
    Ok(providers[idx].clone())
}

fn cloud_choices() -> String {

View on GitHub (pinned to 433685b202)