Hmbown/CodeWhale · error · anyhow::Error

This binary's `login` command does not store provider keys…

Error message

This binary's `login` command does not store provider keys. Use the `codewhale` CLI: `codewhale login` for the Codewhale account device flow, or `codewhale auth set --provider <id>` for a provider key.

What it means

The TUI binary's run_login unconditionally bails: unlike the codewhale CLI, this binary cannot perform account sign-in or store provider keys at all. Every login invocation reaches one of the two bail!s, with this one covering any call that didn't pass --api-key.

Solutions

  1. Use the `codewhale` CLI instead: `codewhale login` for device-flow account sign-in
  2. Or `codewhale auth set --provider <id>` to store a provider key
  3. Install the codewhale CLI if only the TUI binary is present

Example fix

// before
codewhale-tui login
// after
codewhale login
Defensive patterns

Strategy: fallback

Validate before calling

// detect TUI binary and route auth to the codewhale CLI
if binary_name() == "codewhale-tui" { exec("codewhale", &["login"])?; }

Prevention

When it happens

Trigger: Running `login` (with or without --api-key) in the TUI binary — run_login always errors, directing the user to the codewhale CLI's device-flow login or auth set.

Common situations: Users trying to authenticate from inside the TUI binary because that's the only binary they installed; following CLI documentation while running the TUI binary.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

/// `Config`, so copying the saved value here keeps those entry points from
/// silently falling back to a route classifier or an older config.toml value.
fn apply_saved_reasoning_preference(config: &mut Config, settings: &crate::settings::Settings) {
    let Some(reasoning_effort) = settings.reasoning_effort.as_ref() else {
        return;
    };
    config.reasoning_effort = Some(reasoning_effort.clone());
    config.reasoning_effort_inferred_from_legacy_alias = false;
}

fn run_login(api_key: Option<String>) -> Result<()> {
    if api_key.is_some() {
        bail!(
            "`login --api-key` is not account sign-in. \
             Use `codewhale login` for the Codewhale account, \
             or `codewhale auth set --provider <id>` for a provider key."
        );
    }
    bail!(
        "This binary's `login` command does not store provider keys. \
         Use the `codewhale` CLI: `codewhale login` for the Codewhale account device flow, \
         or `codewhale auth set --provider <id>` for a provider key."
    );
}

fn run_logout() -> Result<()> {
    config::clear_api_key()?;
    println!("Cleared saved API key.");
    Ok(())
}

async fn run_xai_device_auth(config_path: Option<&Path>) -> Result<()> {
    let pending = crate::oauth::login(crate::oauth::OAuthProvider::Xai).await?;
    let activation = crate::oauth::activate_login(pending, config_path, None)?;
    println!(
        "xAI OAuth is ready; activated {} via {}",
        codewhale_config::quote_os_path(&activation.auth_path),

View on GitHub (pinned to 73e0f67d83)