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
- 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`)
- Re-authenticate the Claude CLI (its login flow) and retry
- 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
- Run interactive auth flows in a real TTY, not CI or piped shells
- Prefer the non-interactive `auth paste-token` path in automation
- Keep the Claude CLI updated and logged in before starting quickstart
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
- Token cannot be empty
- auth_secret cannot be empty
- auth_secret must be 64 characters or fewer
- auth_secret must contain only ASCII letters, numbers, unders
- auth_secret requires a config.toml path
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/73f17553a4881cc0.
Report an issue: GitHub.