{"record":{"id":"f4cd48202b82910c","repo":"Hmbown/CodeWhale","slug":"account-agent-model-unconfigured","errorCode":"account_agent_model_unconfigured","errorMessage":"This Codewhale account has no agent model configured. Choose one in the Codewhale app, or run `codewhale account keys set <provider>`.","messagePattern":"This Codewhale account has no agent model configured\\. Choose one in the Codewhale app, or run `codewhale account keys set <provider>`\\.","errorType":"error_code","errorClass":"MachineError","httpStatus":409,"severity":"error","filePath":"crates/cli/src/cloud/machine.rs","lineNumber":1173,"sourceCode":"        writeln!(out, \"Account ID: {}\", printable(account_id))?;\n    }\n    writeln!(out, \"This account is ready to run machine work.\")?;\n    Ok(())\n}\n\n// ---------------------------------------------------------------------------\n// Review wiring\n// ---------------------------------------------------------------------------\n\n/// Map the account's configured provider identifier onto a local route.\n///\n/// `codewhale review` hard-errors when a model resolves to several configured\n/// routes. When CI authenticates with a machine key the account has already\n/// answered that question, so the account's own provider is the disambiguator\n/// — no new flag, and no guess.\npub(crate) fn review_provider_from_agent(agent: &AgentState) -> Result<ProviderKind> {\n    if !agent.configured {\n        return Err(anyhow::Error::new(MachineError::new(\n            409,\n            \"account_agent_model_unconfigured\",\n            \"This Codewhale account has no agent model configured. Choose one in the Codewhale \\\napp, or run `codewhale account keys set <provider>`.\",\n            EXIT_AGENT_UNCONFIGURED,\n        )));\n    }\n    let provider = agent.model_provider.trim();\n    parse_route_kind(provider).ok_or_else(|| {\n        anyhow!(\n            \"This Codewhale account is configured for agent provider `{}`, which this CLI build \\\ndoes not know. Upgrade `codewhale`, or choose a supported provider in the Codewhale app.\",\n            printable(provider)\n        )\n    })\n}\n\n#[cfg(test)]","sourceCodeStart":1155,"sourceCodeEnd":1191,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/cloud/machine.rs#L1155-L1191","documentation":"`codewhale review` must know which provider route to use, and when a model would resolve to several configured routes the account's configured agent model is the tiebreaker. This error is thrown by review_provider_from_agent when AgentState.configured is false — the account has never chosen an agent model — so the CLI cannot disambiguate. It exits with EXIT_AGENT_UNCONFIGURED and a code of account_agent_model_unconfigured.","triggerScenarios":"Running `codewhale review` (typically in CI authenticated with a machine key) against an account where the agent model has never been set in the Codewhale app, and the model config resolves ambiguously to multiple routes.","commonSituations":"Fresh Codewhale account used in CI before any model selection was made in the app; team provisioned machine keys but skipped app-side agent-model setup; account model settings were reset.","solutions":["Set the agent model in the Codewhale web app, or run `codewhale account keys set <provider>` from the CLI","Re-run `codewhale review` after the account is configured","In CI, bake the setup step (`account keys set <provider>`) into the pipeline before review","If multiple routes are intended, narrow the local model config so only one route matches"],"exampleFix":"// before (CI workflow)\n- run: codewhale review\n// after\n- run: codewhale account keys set anthropic\n- run: codewhale review","handlingStrategy":"validation","validationCode":"// preflight in CI before review\ncodewhale account keys set \"$REVIEW_PROVIDER\" || { echo 'agent model not configured'; exit 1; }","typeGuard":null,"tryCatchPattern":"match review_provider_from_agent(&agent) {\n    Err(e) if e.downcast_ref::<MachineError>().map(|m| m.code.as_str()) == Some(\"account_agent_model_unconfigured\") => {\n        eprintln!(\"Set the agent model in the Codewhale app first\");\n        std::process::exit(EXIT_AGENT_UNCONFIGURED);\n    }\n    r => r,\n}","preventionTips":["Provision new CI accounts with an explicit `account keys set <provider>` step","Add a smoke CI job that runs review on a trivial diff to catch unconfigured accounts","Document the app-side agent-model step in onboarding for machine-key users"],"tags":["cli","config","ci","routing"],"backgroundTag":"missing-required-config","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}