{"record":{"id":"5c818bf5e84e6a15","repo":"Hmbown/CodeWhale","slug":"login-api-key-is-not-account-sign-in-use-codewhale-login-for","errorCode":null,"errorMessage":"`login --api-key` is not account sign-in. Use `codewhale login` for the Codewhale account, or `codewhale auth set --provider <id>` for a provider key.","messagePattern":"`login --api-key` is not account sign-in\\. Use `codewhale login` for the Codewhale account, or `codewhale auth set --provider <id>` for a provider key\\.","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":8413,"sourceCode":"\n/// Apply the same reasoning-preference precedence as interactive `App`\n/// construction to non-TUI runtimes.\n///\n/// `/model` and the config editor persist this preference in `settings.toml`.\n/// Exec, review, workflow, ACP, and runtime-thread launches all begin with a\n/// `Config`, so copying the saved value here keeps those entry points from\n/// silently falling back to a route classifier or an older config.toml value.\nfn apply_saved_reasoning_preference(config: &mut Config, settings: &crate::settings::Settings) {\n    let Some(reasoning_effort) = settings.reasoning_effort.as_ref() else {\n        return;\n    };\n    config.reasoning_effort = Some(reasoning_effort.clone());\n    config.reasoning_effort_inferred_from_legacy_alias = false;\n}\n\nfn run_login(api_key: Option<String>) -> Result<()> {\n    if api_key.is_some() {\n        bail!(\n            \"`login --api-key` is not account sign-in. \\\n             Use `codewhale login` for the Codewhale account, \\\n             or `codewhale auth set --provider <id>` for a provider key.\"\n        );\n    }\n    bail!(\n        \"This binary's `login` command does not store provider keys. \\\n         Use the `codewhale` CLI: `codewhale login` for the Codewhale account device flow, \\\n         or `codewhale auth set --provider <id>` for a provider key.\"\n    );\n}\n\nfn run_logout() -> Result<()> {\n    config::clear_api_key()?;\n    println!(\"Cleared saved API key.\");\n    Ok(())\n}\n","sourceCodeStart":8395,"sourceCodeEnd":8431,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L8395-L8431","documentation":"The TUI binary's login command refuses --api-key because storing provider keys is not account sign-in. It bails with guidance pointing at the real flows: `codewhale login` for the Codewhale account and `codewhale auth set --provider <id>` for provider keys.","triggerScenarios":"Running login --api-key sk-... in the TUI binary — the flag is recognized but intentionally unsupported.","commonSituations":"Users copying CLI docs meant for the codewhale CLI into the TUI binary; muscle memory from other tools where login --api-key sets keys; migrating from an older binary where the flag stored keys.","solutions":["Run `codewhale login` for Codewhale account (device flow) sign-in","Run `codewhale auth set --provider <id>` to store a provider API key","Use `codewhale login` with no flags in this binary"],"exampleFix":"// before\ncodewhale-tui login --api-key sk-...\n// after\ncodewhale auth set --provider openai   # or: codewhale login","handlingStrategy":"validation","validationCode":"if cmd == \"login\" && args.contains(\"--api-key\") { eprintln!(\"use `codewhale auth set --provider <id>` instead\"); return 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `codewhale auth set --provider <id>` for provider keys","Use `codewhale login` for account sign-in","Check which binary you're running before following CLI docs"],"tags":["cli","auth","login"],"backgroundTag":"invalid-cli-argument","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}