Hmbown/CodeWhale · error · anyhow::Error

unknown field '{field_key}' for custom provider '{provider_i

Error message

unknown field '{field_key}' for custom provider '{provider_id}': expected one of api_key, base_url, model, context_window, mode, wire, auth_mode, insecure_skip_tls_verify, http_headers, path_suffix, kind

What it means

set_custom_provider_value (crates/config/src/lib.rs:2692) rejects `config set providers.<custom>.<field>` when <field> is neither `kind` nor parseable by ProviderConfigField::parse. Custom providers accept a slightly wider set than built-ins (adds wire and kind). The bail exists so a typo fails loudly instead of silently writing a dead extras key (#5167).

Source

Thrown at crates/config/src/lib.rs:2692

                 insecure_skip_tls_verify, http_headers, path_suffix"
            );
        }
        if field_key == "kind" {
            let compatible =
                value.trim().to_ascii_lowercase().replace('_', "-") == "openai-compatible";
            if !compatible {
                bail!(
                    "custom provider '{provider_id}' must set [providers.{provider_id}].kind = \"openai-compatible\""
                );
            }
            self.custom_provider_table_mut(provider_id)?.insert(
                "kind".to_string(),
                toml::Value::String(value.trim().to_string()),
            );
            return Ok(());
        }
        let Some(field) = ProviderConfigField::parse(field_key) else {
            bail!(
                "unknown field '{field_key}' for custom provider '{provider_id}': \
                 expected one of {CUSTOM_PROVIDER_FIELD_HINT}"
            );
        };
        let toml_value = match field {
            ProviderConfigField::ApiKey
            | ProviderConfigField::BaseUrl
            | ProviderConfigField::Model
            | ProviderConfigField::Mode
            | ProviderConfigField::Wire
            | ProviderConfigField::AuthMode
            | ProviderConfigField::PathSuffix => toml::Value::String(value.to_string()),
            ProviderConfigField::ContextWindow => {
                toml::Value::Integer(i64::from(parse_context_window(value)?))
            }
            ProviderConfigField::InsecureSkipTlsVerify => toml::Value::Boolean(parse_bool(value)?),
            ProviderConfigField::HttpHeaders => toml::Value::Table(
                parse_http_headers(value)?

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Fix the field name to one of: api_key, base_url, model, context_window, mode, wire, auth_mode, insecure_skip_tls_verify, http_headers, path_suffix, kind
  2. Set per-request model options in the request/agent config, not the provider table
  3. Tab-complete or list provider fields before writing in scripts

Example fix

# before
codewhale config set providers.local bas_url http://localhost:8080/v1
# -> unknown field 'bas_url' for custom provider 'local'

# after
codewhale config set providers.local base_url http://localhost:8080/v1
Defensive patterns

Strategy: validation

Validate before calling

const CUSTOM_FIELDS: &[&str] = &["api_key","base_url","model","context_window","mode","wire","auth_mode","insecure_skip_tls_verify","http_headers","path_suffix","kind"];
assert!(CUSTOM_FIELDS.contains(&field_key)); // before config set on a custom id

Type guard

fn is_custom_provider_field(field: &str) -> bool {
    ["api_key","base_url","model","context_window","mode","wire","auth_mode","insecure_skip_tls_verify","http_headers","path_suffix","kind"].contains(&field)
}

Prevention

When it happens

Trigger: `config set providers.<id>.bas_url ...` (typo), or a field like `temperature` that is not part of the provider table schema at all.

Common situations: Typos, assuming arbitrary model options (temperature, max_tokens) are provider-table fields, migrating a config from another tool with different key names.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/024ca3af51bef3af. Report an issue: GitHub.