Hmbown/CodeWhale · error

advisor model ` ` resolved only to a custom provider kind…

Error message

advisor model `{}` resolved only to a custom provider kind without an exact provider identity

What it means

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.

Solutions

  1. Re-add/restore the exact custom provider definition that owns the model so routing can pin the identity
  2. Change the advisor override to a model served by a built-in provider
  3. Verify model_routing config: the explicit route must carry the concrete custom provider, not just the Custom kind

Example fix

// before
[[custom_provider]] name = "a"  # definition lost; model still routed as kind=Custom
// after
[[custom_provider]] name = "a", models = ["my-finetune"]  # exact identity restored
Defensive patterns

Strategy: validation

Validate before calling

// before invoking, confirm the explicit route resolves to a concrete provider, not bare ApiProvider::Custom

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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/7124497cdc70711f. Report an issue: GitHub.

Appendix: source

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

    if config.providers.as_ref().is_some_and(|providers| {
        providers.custom.values().any(|provider| {
            provider
                .model
                .as_deref()
                .is_some_and(|model| model.trim().eq_ignore_ascii_case(requested_model.trim()))
        })
    }) {
        anyhow::bail!(
            "advisor model `{}` belongs to a custom provider but no exact provider identity is carried",
            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)?

View on GitHub (pinned to 73e0f67d83)