{"record":{"id":"7124497cdc70711f","repo":"Hmbown/CodeWhale","slug":"advisor-model-resolved-only-to-a-custom-provider-kind","errorCode":null,"errorMessage":"advisor model `{}` resolved only to a custom provider kind without an exact provider identity","messagePattern":"advisor model `(.+?)` resolved only to a custom provider kind without an exact provider identity","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/advisor.rs","lineNumber":487,"sourceCode":"    if config.providers.as_ref().is_some_and(|providers| {\n        providers.custom.values().any(|provider| {\n            provider\n                .model\n                .as_deref()\n                .is_some_and(|model| model.trim().eq_ignore_ascii_case(requested_model.trim()))\n        })\n    }) {\n        anyhow::bail!(\n            \"advisor model `{}` belongs to a custom provider but no exact provider identity is carried\",\n            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)?","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/advisor.rs#L469-L505","documentation":"When resolve_explicit_route_with_inventory resolves the requested model but the resulting provider kind is only ApiProvider::Custom (a generic kind with no exact custom-provider identity attached), exact_advisor_client fails closed — a bare custom kind is not routable because the concrete custom provider is unknown.","triggerScenarios":"Calling run_advisor_for_turn with an advisor model override whose explicit route resolves to the Custom provider kind without an exact identity — e.g. the model inventory maps the model to 'custom' generically, or config lost which specific custom provider owns the model.","commonSituations":"Config merge/import dropped per-custom-provider details while keeping the model list; model_routing resolving a model name that only matches the generic Custom kind; tests like advisor_foreign_custom_override_fails_closed_without_exact_identity exercising this fail-closed path.","solutions":["Re-add/restore the exact custom provider definition that owns the model so routing can pin the identity","Change the advisor override to a model served by a built-in provider","Verify model_routing config: the explicit route must carry the concrete custom provider, not just the Custom kind"],"exampleFix":"// before\n[[custom_provider]] name = \"a\"  # definition lost; model still routed as kind=Custom\n// after\n[[custom_provider]] name = \"a\", models = [\"my-finetune\"]  # exact identity restored","handlingStrategy":"validation","validationCode":"// before invoking, confirm the explicit route resolves to a concrete provider, not bare ApiProvider::Custom","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the owning custom provider fully defined in config","After config import/merge, verify custom provider identities survived","Prefer built-in-provider models for advisor overrides when custom identity cannot be carried"],"tags":["advisor","model-routing","custom-provider","config"],"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"}