{"record":{"id":"47100080bd56eb36","repo":"zeroclaw-labs/zeroclaw","slug":"token-cannot-be-empty","errorCode":null,"errorMessage":"Token cannot be empty","messagePattern":"Token cannot be empty","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":7421,"sourceCode":"}\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)],\n            \"  Saved Claude setup token.\",\n        )\n    );\n    Ok(())\n}\n\n#[allow(clippy::too_many_lines)]\n#[cfg(feature = \"agent-runtime\")]","sourceCodeStart":7403,"sourceCodeEnd":7439,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/src/main.rs#L7403-L7439","documentation":"In the quickstart `claude setup-token` inline flow, ZeroClaw prompts for the token the subcommand printed; input that is empty or only whitespace bails before anything is written to `providers.models.anthropic.<alias>.api_key`.","triggerScenarios":"Pressing Enter (or pasting only whitespace) at the 'Paste the token from `claude setup-token`' prompt in run_anthropic_setup_token_inline.","commonSituations":"Non-interactive contexts where stdin is empty or closed (CI, piped scripts) so read_auth_input returns nothing; users pressing Enter to try to skip; clipboard paste failing silently.","solutions":["Re-run the flow and paste the full token printed by `claude setup-token`","In scripts, skip the prompt entirely: `zeroclaw auth paste-token --model-provider anthropic --token <value>`","Leading/trailing spaces are trimmed, so paste the whole value — only fully blank input is rejected"],"exampleFix":"# before: empty input at the 'Paste the token' prompt → bail\n# after\nclaude setup-token   # prints the token\nzeroclaw auth paste-token --model-provider anthropic --token \"$TOKEN\"","handlingStrategy":"validation","validationCode":"read -r tok\n[ -n \"$(printf '%s' \"$tok\" | tr -d '[:space:]')\" ] || { echo \"empty token; aborting\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pipe tokens from a secret store instead of prompting","Treat a blank paste as an abort signal and restart the flow cleanly","Never log the token while debugging the prompt"],"tags":["auth","input-validation","quickstart","anthropic","zeroclaw"],"backgroundTag":"empty-required-input","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}