{"record":{"id":"73f17553a4881cc0","repo":"zeroclaw-labs/zeroclaw","slug":"claude-setup-token-exited-with-status-status","errorCode":null,"errorMessage":"`claude setup-token` exited with status {status}","messagePattern":"`claude setup-token` exited with status (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":7413,"sourceCode":"            ta(\n                \"cli-quickstart-auth-failed\",\n                &[(\"error\", &error)],\n                \"  Auth setup didn't complete.\",\n            )\n        );\n        println!(\"{skip_hint}\");\n    }\n}\n\n#[cfg(feature = \"agent-runtime\")]\nasync fn run_anthropic_setup_token_inline(alias: &str, config: &mut Config) -> Result<()> {\n    let status = tokio::process::Command::new(\"claude\")\n        .arg(\"setup-token\")\n        .status()\n        .await\n        .context(\"failed to run `claude setup-token`; is the Claude CLI installed and on PATH?\")?;\n    if !status.success() {\n        bail!(\"`claude setup-token` exited with status {status}\");\n    }\n\n    let token = read_auth_input(&t(\n        \"cli-quickstart-auth-anthropic-token-prompt\",\n        \"Paste the token from `claude setup-token`\",\n    ))?;\n    if token.trim().is_empty() {\n        bail!(\"Token cannot be empty\");\n    }\n\n    let path = format!(\"providers.models.anthropic.{alias}.api_key\");\n    config.set_prop_persistent(&path, token.trim())?;\n    Box::pin(config.save_dirty()).await?;\n    println!(\n        \"{}\",\n        ta(\n            \"cli-quickstart-auth-anthropic-saved\",\n            &[(\"alias\", alias)],","sourceCodeStart":7395,"sourceCodeEnd":7431,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/src/main.rs#L7395-L7431","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running quickstart in CI or a non-interactive SSH session; stale Claude CLI credentials; an outdated `claude` binary predating setup-token.","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`"],"exampleFix":"# before: interactive quickstart path where `claude setup-token` exits 1\n# after: manual, non-interactive equivalent\nclaude setup-token   # run in a real TTY, copy the printed token\nzeroclaw auth paste-token --model-provider anthropic","handlingStrategy":"validation","validationCode":"command -v claude >/dev/null || { echo \"Claude CLI not on PATH\"; exit 1; }\nclaude --help 2>/dev/null | grep -q setup-token || { echo \"Claude CLI too old for setup-token\"; exit 1; }","typeGuard":null,"tryCatchPattern":"if ! claude setup-token; then\n  echo \"falling back to manual paste-token\" >&2\n  zeroclaw auth paste-token --model-provider anthropic   # enter token by hand\nfi","preventionTips":["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"],"tags":["auth","anthropic","claude-cli","subprocess","zeroclaw"],"backgroundTag":"external-command-failed","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}