Hmbown/CodeWhale · error · anyhow::Error
unavailable credential
Error message
unavailable credential
What it means
Second site of the deliberate "unavailable credential" masking: while handling `auth print-api-key`, ConfigStore::load itself failed (invalid TOML, unreadable file, bad permissions) and the real error is replaced so config internals never leak through the credential pipe. The underlying problem is a broken config file, not missing credentials.
Source
Thrown at crates/cli/src/lib.rs:1761
auth_mode: None,
output_mode: cli.output_mode.clone(),
log_level: cli.log_level.clone(),
telemetry: cli.telemetry,
approval_policy: cli.approval_policy.clone(),
sandbox_mode: cli.sandbox_mode.clone(),
yolo: Some(cli.yolo),
verbosity: cli.verbosity.clone(),
};
if uses_raw_tui_provider
&& let Some((resolved_runtime, passthrough)) =
prepare_raw_provider_tui_dispatch(&cli, command.as_ref(), &runtime_overrides)?
{
return run_tui_in_process(&cli, &resolved_runtime, passthrough);
}
let mut store = ConfigStore::load(cli.config.clone()).map_err(|error| {
if pipe_api_key_handoff {
anyhow!("unavailable credential")
} else {
error
}
})?;
match command {
Some(Commands::Run(args)) => {
let resolved_runtime = resolve_runtime_for_dispatch(&mut store, &runtime_overrides);
run_tui_in_process(&cli, &resolved_runtime, args.args)
}
Some(Commands::Doctor(args)) => {
let resolved_runtime =
resolve_runtime_for_diagnostic_dispatch(&store, &runtime_overrides);
run_tui_in_process(&cli, &resolved_runtime, tui_args("doctor", args))
}
Some(Commands::Models(args)) => {
let resolved_runtime = resolve_runtime_for_dispatch(&mut store, &runtime_overrides);
run_tui_in_process(&cli, &resolved_runtime, tui_args("models", args))
}View on GitHub (pinned to 8880682c63)
Solutions
- Run any non-handoff command (`codewhale doctor`) outside the pipe — it prints the true config-load error
- Fix or restore the config file's TOML
- As a workaround, pass --config pointing at a known-good file for the handoff
Example fix
# before codewhale auth print-api-key | my-client # -> unavailable credential (config broken) # after codewhale doctor # shows real error: invalid TOML at line N # fix config, then: codewhale auth print-api-key | my-client
Defensive patterns
Strategy: validation
Validate before calling
# Validate the config outside the credential pipe before scripting the handoff:
codewhale doctor >/dev/null 2>&1 || { echo "config broken — fix first"; exit 1; }
codewhale auth print-api-key | my-client Prevention
- Treat this message during print-api-key as a config-load failure, not a credential problem
- Always run a non-handoff command to get the real TOML/config error
- Keep config under version control so hand-edit breakage is a one-line revert
- In CI, use --config with a known-good file for handoff tests
When it happens
Trigger: Running `codewhale auth print-api-key | client` while the config file fails to load: TOML syntax error from hand editing, file unreadable (permissions), or config written by an incompatible newer version.
Common situations: Hand-edited config with a missing quote/bracket; config shared across CLI versions; read-only $HOME in CI or containers.
Related errors
- unavailable credential
- Secret storage write failed for {slot}: {err}. Refusing to w
- {error}; additionally could not verify secret-store rollback
- {error}; additionally failed to restore prior secret-store s
- invalid JSON payload at key {MCP_SERVER_DEFINITIONS_KEY}; co
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/9d72903d8474a35f.
Report an issue: GitHub.