Hmbown/CodeWhale · error

agent profile {} provider must be a simple provider id

Error message

agent profile {} provider must be a simple provider id

What it means

validate_agent_profile_provider requires the provider to be a simple token (ASCII alphanumerics plus '-', '_', '.'). It must match a built-in provider id or a user-named OpenAI-compatible custom provider defined as [providers.<id>] in the session config (#3965, #4093). The loader trims the value before validating, so this fires on invalid characters inside the id.

Source

Thrown at crates/tui/src/fleet/profile.rs:503

        );
    }
    Ok(())
}

/// Validate an explicit `provider` field as a safe provider id (#4093).
///
/// Built-in providers are accepted by the runtime vocabulary, and user-named
/// OpenAI-compatible custom providers are accepted as simple tokens so the
/// launch path can resolve `[providers.<id>]` from the session config (#3965).
/// This field remains the ONLY place a profile's provider is established:
/// callers never infer it from `model` (EPIC #2608).
fn validate_agent_profile_provider(path: &Path, value: &str) -> Result<()> {
    let trimmed = value.trim();
    if trimmed.is_empty() {
        bail!("agent profile {} provider cannot be empty", path.display());
    }
    if trimmed != value || !trimmed.chars().all(is_agent_profile_token_char) {
        bail!(
            "agent profile {} provider must be a simple provider id",
            path.display()
        );
    }
    Ok(())
}

fn normalize_agent_profile_reasoning_effort(
    path: &Path,
    value: Option<&str>,
) -> Result<Option<String>> {
    let Some(value) = non_empty_trimmed(value) else {
        return Ok(None);
    };
    if matches!(
        value.to_ascii_lowercase().as_str(),
        "inherit" | "parent" | "same" | "current" | "default" | "unset"
    ) {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Use the bare provider id: provider = "openai" or the exact key of your [providers.<id>] table
  2. If you meant a model, move it to the model field - provider is never inferred from or written with model ids
  3. Check [providers.<id>] in the session config and use that same id verbatim

Example fix

# before
provider = "openai/gpt-4o"

# after
provider = "openai"
model = "gpt-4o"
Defensive patterns

Strategy: validation

Validate before calling

fn is_valid_provider_id(value: &str) -> bool {
    let t = value.trim();
    !t.is_empty()
        && t == value
        && t.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | '.'))
}
// also check the id exists in session config: [providers.<id>] or a built-in name

Type guard

fn is_valid_provider(value: &str) -> bool {
    let t = value.trim();
    !t.is_empty()
        && t.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | '.'))
}

Try / catch

match load_agent_profile_file(&path) {
    Ok(p) => Ok(p),
    Err(err) if err.to_string().contains("simple provider id") => {
        Err(anyhow!("profile {path:?}: provider must be a bare id like 'openai' or a [providers.<id>] key"))
    }
    Err(err) => Err(err),
}

Prevention

When it happens

Trigger: provider = "openai compatible" (inner space), provider = "openai/gpt-4o" (a provider/model id put in the provider field), provider = "My Provider", or any value containing ':', '/', spaces, or quotes.

Common situations: Pasting a full model string or a URL into the provider field; using a human label instead of the config key; typos introducing punctuation into a custom provider id.

Related errors


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