Hmbown/CodeWhale · error
provider authority checked above
Error message
provider authority checked above
What it means
An internal invariant assertion in `validate_fleet_task_routes`: when a task pins a model without naming an explicit provider, the code expects `config` to be `Some` because earlier branches already handled the explicit-provider cases. The expect fires only if the preceding provider-authority logic and this assumption drift out of sync — i.e. a model pin reached this line with `config == None` despite the checks above.
Solutions
- Re-read the branches above the expect and restore the invariant that pinned_model && explicit_provider.is_none() implies config is Some
- Handle the configless pinned-model case explicitly with a bail! instead of expecting
- Add a test covering the new route shape that reaches this line
- Replace expect with `let Some(config) = config else { bail!(...) }` so a violated invariant produces a diagnosable error, not a panic
Example fix
// before
let config = config.expect("provider authority checked above");
// after
let config = config.ok_or_else(|| {
anyhow::anyhow!("Fleet task `{}` pins model `{model}` without a live route config", task.id)
})?; Defensive patterns
Strategy: type-guard
Validate before calling
// rust, caller-side check before validation
if task.model.is_some() && task.provider.is_none() && route_config.is_none() {
return Err(anyhow!("task {} pins a model without a route config", task.id));
} Type guard
// rust
let config = match config {
Some(c) => c,
None => return Err(anyhow!("pinned model requires live route config")),
}; Try / catch
// rust
match validate_fleet_task_routes(&tasks, source, config) {
Ok(()) => {},
Err(e) => eprintln!("fleet route validation failed: {e}"),
} Prevention
- When editing validation branches, re-check which invariants later code relies on
- Prefer let-else/bail! over expect for config-dependent invariants
- Cover every route shape (pinned/unpinned × provider/no-provider) with tests
When it happens
Trigger: Adding or modifying the earlier bail!/match arms in `validate_fleet_task_routes` so a pinned-model task with no explicit provider and no live config falls through to this line; calling validation with configless routes in a way the earlier checks do not cover (e.g. a new pin syntax or provider-inheritance shape).
Common situations: Refactors of fleet route validation, new task-route fields that skip the explicit-provider check, regression tests introducing pinned models without attaching route config.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- agent profile provider cannot be empty
- agent profile provider must be a simple provider id
- event recovery buffer fits u64
- event transaction runs once
- Runtime store root
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/6d97ed3b5f011517.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/fleet/worker_runtime.rs:299
let explicit_provider = explicit_fleet_provider_id(agent_profile);
if config.is_none() && explicit_provider.is_none() {
bail!(
"Fleet task `{}` has no provider authority for model `{model}` (source={source}); attach the resolved route config or set the agent profile provider explicitly",
task.id,
);
}
if config.is_none()
&& let Some(provider_id) = explicit_provider.as_deref()
&& ApiProvider::parse(provider_id)
.is_none_or(|provider| provider == ApiProvider::Custom)
{
bail!(
"Fleet task `{}` names custom provider=`{provider_id}`, but a provider name alone does not prove its endpoint or model; attach the live route config before creating the run",
task.id,
);
}
if pinned_model && explicit_provider.is_none() {
let config = config.expect("provider authority checked above");
let (provider, base_url) = (config.api_provider(), config.deepseek_base_url());
if let Err(reason) =
crate::route_runtime::validate_unpinned_model_provider(provider, &model, &base_url)
{
bail!("Fleet task `{}`: {reason} (source={source})", task.id);
}
}
let route = resolve_fleet_route_with_config(task, agent_profiles, session_model, config);
let provider = explicit_provider
.map(|provider| format!("provider=`{provider}`"))
.unwrap_or_else(|| {
"no explicit provider (resolves against the session/default provider)".to_string()
});
if route.is_none() {
if pinned_model {
bail!(
"Fleet task `{}` pins model `{}` with {} (source={source}), but that route does not \View on GitHub (pinned to 433685b202)