Hmbown/CodeWhale · error · MachineError
account_agent_model_unconfigured
account_agent_model_unconfigured
Error message
This Codewhale account has no agent model configured. Choose one in the Codewhale app, or run `codewhale account keys set <provider>`.
What it means
`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.
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
Example fix
// before (CI workflow) - run: codewhale review // after - run: codewhale account keys set anthropic - run: codewhale review
Defensive patterns
Strategy: validation
Validate before calling
// preflight in CI before review
codewhale account keys set "$REVIEW_PROVIDER" || { echo 'agent model not configured'; exit 1; } Try / catch
match review_provider_from_agent(&agent) {
Err(e) if e.downcast_ref::<MachineError>().map(|m| m.code.as_str()) == Some("account_agent_model_unconfigured") => {
eprintln!("Set the agent model in the Codewhale app first");
std::process::exit(EXIT_AGENT_UNCONFIGURED);
}
r => r,
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- bundle at is bytes; the limit is bytes
- bundle at is bytes; the limit is bytes
- cannot resolve the current Codewhale route
- config export requires --portable; plain export is not…
- `config set` does not support nested key
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/f4cd48202b82910c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/cloud/machine.rs:1173
writeln!(out, "Account ID: {}", printable(account_id))?;
}
writeln!(out, "This account is ready to run machine work.")?;
Ok(())
}
// ---------------------------------------------------------------------------
// Review wiring
// ---------------------------------------------------------------------------
/// Map the account's configured provider identifier onto a local route.
///
/// `codewhale review` hard-errors when a model resolves to several configured
/// routes. When CI authenticates with a machine key the account has already
/// answered that question, so the account's own provider is the disambiguator
/// — no new flag, and no guess.
pub(crate) fn review_provider_from_agent(agent: &AgentState) -> Result<ProviderKind> {
if !agent.configured {
return Err(anyhow::Error::new(MachineError::new(
409,
"account_agent_model_unconfigured",
"This Codewhale account has no agent model configured. Choose one in the Codewhale \
app, or run `codewhale account keys set <provider>`.",
EXIT_AGENT_UNCONFIGURED,
)));
}
let provider = agent.model_provider.trim();
parse_route_kind(provider).ok_or_else(|| {
anyhow!(
"This Codewhale account is configured for agent provider `{}`, which this CLI build \
does not know. Upgrade `codewhale`, or choose a supported provider in the Codewhale app.",
printable(provider)
)
})
}
#[cfg(test)]View on GitHub (pinned to 73e0f67d83)