{"record":{"id":"9d72903d8474a35f","repo":"Hmbown/CodeWhale","slug":"unavailable-credential-9d7290","errorCode":null,"errorMessage":"unavailable credential","messagePattern":"unavailable credential","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":1761,"sourceCode":"        auth_mode: None,\n        output_mode: cli.output_mode.clone(),\n        log_level: cli.log_level.clone(),\n        telemetry: cli.telemetry,\n        approval_policy: cli.approval_policy.clone(),\n        sandbox_mode: cli.sandbox_mode.clone(),\n        yolo: Some(cli.yolo),\n        verbosity: cli.verbosity.clone(),\n    };\n    if uses_raw_tui_provider\n        && let Some((resolved_runtime, passthrough)) =\n            prepare_raw_provider_tui_dispatch(&cli, command.as_ref(), &runtime_overrides)?\n    {\n        return run_tui_in_process(&cli, &resolved_runtime, passthrough);\n    }\n\n    let mut store = ConfigStore::load(cli.config.clone()).map_err(|error| {\n        if pipe_api_key_handoff {\n            anyhow!(\"unavailable credential\")\n        } else {\n            error\n        }\n    })?;\n    match command {\n        Some(Commands::Run(args)) => {\n            let resolved_runtime = resolve_runtime_for_dispatch(&mut store, &runtime_overrides);\n            run_tui_in_process(&cli, &resolved_runtime, args.args)\n        }\n        Some(Commands::Doctor(args)) => {\n            let resolved_runtime =\n                resolve_runtime_for_diagnostic_dispatch(&store, &runtime_overrides);\n            run_tui_in_process(&cli, &resolved_runtime, tui_args(\"doctor\", args))\n        }\n        Some(Commands::Models(args)) => {\n            let resolved_runtime = resolve_runtime_for_dispatch(&mut store, &runtime_overrides);\n            run_tui_in_process(&cli, &resolved_runtime, tui_args(\"models\", args))\n        }","sourceCodeStart":1743,"sourceCodeEnd":1779,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/cli/src/lib.rs#L1743-L1779","documentation":"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.","triggerScenarios":"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.","commonSituations":"Hand-edited config with a missing quote/bracket; config shared across CLI versions; read-only $HOME in CI or containers.","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"],"exampleFix":"# before\n codewhale auth print-api-key | my-client   # -> unavailable credential (config broken)\n\n# after\n codewhale doctor                            # shows real error: invalid TOML at line N \n # fix config, then: \n codewhale auth print-api-key | my-client","handlingStrategy":"validation","validationCode":"# Validate the config outside the credential pipe before scripting the handoff:\n codewhale doctor >/dev/null 2>&1 || { echo \"config broken — fix first\"; exit 1; } \n codewhale auth print-api-key | my-client","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","auth","config","redaction","toml","rust"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}