zeroclaw-labs/zeroclaw · error · anyhow::Error

`claude setup-token` exited with status {status}

Error message

`claude setup-token` exited with status {status}

What it means

During the Anthropic quickstart flow ZeroClaw shells out to `claude setup-token` (tokio::process::Command) and requires a zero exit; a non-zero status aborts the flow. A missing or un-runnable `claude` binary raises a separate 'failed to run' context error — this bail means the command ran and failed.

Source

Thrown at src/main.rs:7413

            ta(
                "cli-quickstart-auth-failed",
                &[("error", &error)],
                "  Auth setup didn't complete.",
            )
        );
        println!("{skip_hint}");
    }
}

#[cfg(feature = "agent-runtime")]
async fn run_anthropic_setup_token_inline(alias: &str, config: &mut Config) -> Result<()> {
    let status = tokio::process::Command::new("claude")
        .arg("setup-token")
        .status()
        .await
        .context("failed to run `claude setup-token`; is the Claude CLI installed and on PATH?")?;
    if !status.success() {
        bail!("`claude setup-token` exited with status {status}");
    }

    let token = read_auth_input(&t(
        "cli-quickstart-auth-anthropic-token-prompt",
        "Paste the token from `claude setup-token`",
    ))?;
    if token.trim().is_empty() {
        bail!("Token cannot be empty");
    }

    let path = format!("providers.models.anthropic.{alias}.api_key");
    config.set_prop_persistent(&path, token.trim())?;
    Box::pin(config.save_dirty()).await?;
    println!(
        "{}",
        ta(
            "cli-quickstart-auth-anthropic-saved",
            &[("alias", alias)],

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Run `claude setup-token` yourself in a working terminal, then store the result via `zeroclaw auth paste-token --model-provider anthropic` (or `zeroclaw auth setup-token`)
  2. Re-authenticate the Claude CLI (its login flow) and retry
  3. Update the Claude CLI and confirm the subcommand exists: `claude --help | grep setup-token`

Example fix

# before: interactive quickstart path where `claude setup-token` exits 1
# after: manual, non-interactive equivalent
claude setup-token   # run in a real TTY, copy the printed token
zeroclaw auth paste-token --model-provider anthropic
Defensive patterns

Strategy: validation

Validate before calling

command -v claude >/dev/null || { echo "Claude CLI not on PATH"; exit 1; }
claude --help 2>/dev/null | grep -q setup-token || { echo "Claude CLI too old for setup-token"; exit 1; }

Try / catch

if ! claude setup-token; then
  echo "falling back to manual paste-token" >&2
  zeroclaw auth paste-token --model-provider anthropic   # enter token by hand
fi

Prevention

When it happens

Trigger: Choosing the `claude setup-token` path in quickstart (`run_anthropic_setup_token_inline`) when the Claude CLI exits non-zero: an expired or absent login session, a CLI version without the `setup-token` subcommand, or a non-interactive TTY where the interactive command fails.

Common situations: Running quickstart in CI or a non-interactive SSH session; stale Claude CLI credentials; an outdated `claude` binary predating setup-token.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/73f17553a4881cc0. Report an issue: GitHub.