Hmbown/CodeWhale · error

advisor model ` ` is not owned by the originating provider…

Error message

advisor model `{}` is not owned by the originating provider and has no unique exact route

What it means

When no explicit route resolves, exact_advisor_client falls back to the originating provider but only if the model's candidate owning providers either are empty or include the current provider. If candidates exist and none equals config.api_provider(), the model would be routed to a provider that does not own it with no unique exact alternative — it bails instead.

Solutions

  1. Set the advisor model to one owned by the currently active provider
  2. Switch config.api_provider to the provider that owns the requested model
  3. Disambiguate the model name (use a provider-qualified/exact identifier) so a unique route resolves

Example fix

// before
# active provider: anthropic
advisor_model: "gpt-4o"   # owned by openai
// after
advisor_model: "claude-sonnet-4"  # owned by the active provider
Defensive patterns

Strategy: validation

Validate before calling

let owners = explicit_route_candidate_providers(config, model); if !owners.is_empty() && !owners.contains(&config.api_provider()) { return Err("model not owned by active provider"); }

Prevention

When it happens

Trigger: run_advisor_for_turn with a model override where explicit_route_candidate_providers returns non-empty candidates and the active config.api_provider() is not among them — i.e. the model is owned by a different provider than the session's current one, and routing cannot pick a unique exact route.

Common situations: Advisor override naming e.g. an OpenAI-owned model while the session runs on Anthropic; model name that exists under several providers so no unique route exists and none matches the current provider; switching the active provider after saving the override.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/a191d32f62b63fa5. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/tools/subagent/advisor.rs:497

            requested_model.trim()
        );
    }

    let selection =
        crate::model_routing::resolve_explicit_route_with_inventory(config, requested_model);
    let (provider, model) = if let Some(selection) = selection {
        if selection.provider == crate::config::ApiProvider::Custom {
            anyhow::bail!(
                "advisor model `{}` resolved only to a custom provider kind without an exact provider identity",
                requested_model.trim()
            );
        }
        (selection.provider, selection.model)
    } else {
        let candidates =
            crate::model_routing::explicit_route_candidate_providers(config, requested_model);
        if !candidates.is_empty() && !candidates.contains(&config.api_provider()) {
            anyhow::bail!(
                "advisor model `{}` is not owned by the originating provider and has no unique exact route",
                requested_model.trim()
            );
        }
        (config.api_provider(), requested_model.trim().to_string())
    };
    let client = crate::route_runtime::resolve_runtime_route(config, provider, Some(&model))
        .map_err(anyhow::Error::msg)?
        .validate()
        .map(|route| route.client)
        .map_err(anyhow::Error::msg)?;
    Ok((client, model))
}

fn hash_str(s: &str) -> u64 {
    let mut h = DefaultHasher::new();
    s.hash(&mut h);
    h.finish()

View on GitHub (pinned to 73e0f67d83)