Hmbown/CodeWhale · error

DeepSeek uses the root base_url setting

Error message

DeepSeek uses the root base_url setting

What it means

provider_base_url_table_key maps an ApiProvider to its per-provider config table key. DeepSeek and DeepSeekCN are deliberately excluded: their base_url lives in the root config's base_url setting, not a named table, so calling this with either variant bails instead of persisting to the wrong place.

Solutions

  1. Update the root base_url config setting instead of the per-provider table for DeepSeek/DeepSeekCN.
  2. Route DeepSeek base_url persistence through the code path that writes the root setting.
  3. If you need a DeepSeek base_url different from the root setting, use a different provider entry (e.g. a custom provider).

Example fix

// before
persist_provider_base_url_key(config_path, ApiProvider::Deepseek, &url)?;
// after
persist_root_base_url(config_path, &url)?;
Defensive patterns

Strategy: validation

Validate before calling

fn is_deepseek(p: ApiProvider) -> bool { matches!(p, ApiProvider::Deepseek | ApiProvider::DeepseekCN) }
if is_deepseek(provider) { /* write root base_url instead */ }

Type guard

fn uses_per_provider_table(p: ApiProvider) -> bool { !matches!(p, ApiProvider::Deepseek | ApiProvider::DeepseekCN) }

Try / catch

match persist_provider_base_url_key(path, provider, &url) {
    Err(e) if e.to_string().contains("root base_url") => persist_root_base_url(path, &url),
    other => other,
}

Prevention

When it happens

Trigger: Calling persist_provider_base_url_key (via provider_base_url_table_key) with ApiProvider::Deepseek or ApiProvider::DeepseekCN to persist a provider-specific base_url.

Common situations: A settings UI or automation writes a base_url override for the DeepSeek provider through the generic per-provider persistence path instead of updating the root base_url setting.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/config_persistence.rs:576

/// named custom routes use their exact user-owned table id. Only a legacy
/// literal custom route retains its root model field.
pub(crate) fn persist_provider_model_key(
    config_path: Option<&Path>,
    provider: ApiProvider,
    provider_identity: &str,
    value: &str,
) -> anyhow::Result<PathBuf> {
    let path = config_toml_path(config_path)?;
    mutate_config_document(&path, |doc| {
        set_provider_model_document(doc, provider, provider_identity, value)
    })?;
    Ok(path)
}

fn provider_base_url_table_key(provider: ApiProvider) -> anyhow::Result<&'static str> {
    match provider {
        ApiProvider::Deepseek | ApiProvider::DeepseekCN => {
            anyhow::bail!("DeepSeek uses the root base_url setting")
        }
        ApiProvider::DeepseekAnthropic => Ok("deepseek_anthropic"),
        ApiProvider::NvidiaNim => Ok("nvidia_nim"),
        ApiProvider::Openai => Ok("openai"),
        ApiProvider::Anthropic => Ok("anthropic"),
        ApiProvider::Atlascloud => Ok("atlascloud"),
        ApiProvider::WanjieArk => Ok("wanjie_ark"),
        ApiProvider::Volcengine => Ok("volcengine"),
        ApiProvider::Openrouter => Ok("openrouter"),
        ApiProvider::Orcarouter => Ok("orcarouter"),
        ApiProvider::XiaomiMimo => Ok("xiaomi_mimo"),
        ApiProvider::Novita => Ok("novita"),
        ApiProvider::Fireworks => Ok("fireworks"),
        ApiProvider::Siliconflow | ApiProvider::SiliconflowCn => Ok("siliconflow"),
        ApiProvider::Arcee => Ok("arcee"),
        ApiProvider::Huggingface => Ok("huggingface"),
        ApiProvider::Modelscope => Ok("modelscope"),
        ApiProvider::Deepinfra => Ok("deepinfra"),

View on GitHub (pinned to 73e0f67d83)