{"record":{"id":"a191d32f62b63fa5","repo":"Hmbown/CodeWhale","slug":"advisor-model-is-not-owned-by-the-originating-provider-and","errorCode":null,"errorMessage":"advisor model `{}` is not owned by the originating provider and has no unique exact route","messagePattern":"advisor model `(.+?)` is not owned by the originating provider and has no unique exact route","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/advisor.rs","lineNumber":497,"sourceCode":"            requested_model.trim()\n        );\n    }\n\n    let selection =\n        crate::model_routing::resolve_explicit_route_with_inventory(config, requested_model);\n    let (provider, model) = if let Some(selection) = selection {\n        if selection.provider == crate::config::ApiProvider::Custom {\n            anyhow::bail!(\n                \"advisor model `{}` resolved only to a custom provider kind without an exact provider identity\",\n                requested_model.trim()\n            );\n        }\n        (selection.provider, selection.model)\n    } else {\n        let candidates =\n            crate::model_routing::explicit_route_candidate_providers(config, requested_model);\n        if !candidates.is_empty() && !candidates.contains(&config.api_provider()) {\n            anyhow::bail!(\n                \"advisor model `{}` is not owned by the originating provider and has no unique exact route\",\n                requested_model.trim()\n            );\n        }\n        (config.api_provider(), requested_model.trim().to_string())\n    };\n    let client = crate::route_runtime::resolve_runtime_route(config, provider, Some(&model))\n        .map_err(anyhow::Error::msg)?\n        .validate()\n        .map(|route| route.client)\n        .map_err(anyhow::Error::msg)?;\n    Ok((client, model))\n}\n\nfn hash_str(s: &str) -> u64 {\n    let mut h = DefaultHasher::new();\n    s.hash(&mut h);\n    h.finish()","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/advisor.rs#L479-L515","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the advisor model to one owned by the currently active provider","Switch config.api_provider to the provider that owns the requested model","Disambiguate the model name (use a provider-qualified/exact identifier) so a unique route resolves"],"exampleFix":"// before\n# active provider: anthropic\nadvisor_model: \"gpt-4o\"   # owned by openai\n// after\nadvisor_model: \"claude-sonnet-4\"  # owned by the active provider","handlingStrategy":"validation","validationCode":"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\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose advisor models owned by the active provider","Use provider-qualified model identifiers to disambiguate","Re-validate overrides after switching the active provider"],"tags":["advisor","model-routing","provider-mismatch"],"backgroundTag":"invalid-config-value","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"}