openai/codex · error · std::io::Error

InvalidInput

InvalidInput

Error message

`ollama-chat` is no longer supported.
How to fix: replace `ollama-chat` with `ollama` in `model_provider`, `oss_provider`, or `--local-provider`.
More info: https://github.com/openai/codex/discussions/7782

What it means

validate_oss_provider in codex-rs/config/src/config_toml.rs:956 hard-rejects the removed provider id 'ollama-chat' (LEGACY_OLLAMA_CHAT_PROVIDER_ID) with ErrorKind::InvalidInput. The ollama-chat provider was merged into 'ollama', so the old id fails fast with migration instructions and a link to the removal discussion instead of being silently remapped.

Source

Thrown at codex-rs/config/src/config_toml.rs:956

fn deserialize_model_providers<'de, D>(
    deserializer: D,
) -> Result<HashMap<String, ModelProviderInfo>, D::Error>
where
    D: serde::Deserializer<'de>,
{
    let model_providers = HashMap::<String, ModelProviderInfo>::deserialize(deserializer)?;
    validate_model_providers(&model_providers).map_err(serde::de::Error::custom)?;
    Ok(model_providers)
}

#[cfg(test)]
#[path = "bedrock_runtime_tests.rs"]
mod bedrock_runtime_tests;

pub fn validate_oss_provider(provider: &str) -> std::io::Result<()> {
    match provider {
        LMSTUDIO_OSS_PROVIDER_ID | OLLAMA_OSS_PROVIDER_ID => Ok(()),
        LEGACY_OLLAMA_CHAT_PROVIDER_ID => Err(std::io::Error::new(
            std::io::ErrorKind::InvalidInput,
            OLLAMA_CHAT_PROVIDER_REMOVED_ERROR,
        )),
        _ => Err(std::io::Error::new(
            std::io::ErrorKind::InvalidInput,
            format!(
                "Invalid OSS provider '{provider}'. Must be one of: {LMSTUDIO_OSS_PROVIDER_ID}, {OLLAMA_OSS_PROVIDER_ID}"
            ),
        )),
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use pretty_assertions::assert_eq;

    const WORKSPACE_ID_A: &str = "123e4567-e89b-42d3-a456-426614174000";

View on GitHub (pinned to 339751715c)

Solutions

  1. Replace ollama-chat with ollama in model_provider, oss_provider, or --local-provider everywhere it appears
  2. Search every profile and override: rg ollama-chat ~/.codex/config.toml and fix each hit
  3. See https://github.com/openai/codex/discussions/7782 for the migration details

Example fix

# ~/.codex/config.toml (before)
oss_provider = "ollama-chat"

# (after)
oss_provider = "ollama"
Defensive patterns

Strategy: validation

Validate before calling

const LEGACY_OLLAMA_CHAT: &str = "ollama-chat";
let provider = if provider == LEGACY_OLLAMA_CHAT {
    "ollama".to_string() // migrate on read
} else {
    provider
};
validate_oss_provider(&provider)?;

Type guard

fn is_supported_oss_provider(p: &str) -> bool {
    matches!(p, "ollama" | "lmstudio")
}

Try / catch

match validate_oss_provider(&provider) {
    Err(e) if e.kind() == std::io::ErrorKind::InvalidInput
        && e.to_string().contains("ollama-chat") =>
    {
        // rewrite the stored config value to "ollama" and retry once
    }
    other => other?,
}

Prevention

When it happens

Trigger: Setting model_provider = "ollama-chat" or oss_provider = "ollama-chat" in config.toml (including profiles), or passing --local-provider ollama-chat; validate_oss_provider runs during config load and returns the InvalidInput error immediately.

Common situations: Upgrading codex-rs past the removal while an old config.toml, a shared dotfiles profile, or CI wrapper scripts still say ollama-chat; following tutorials written before the merge.

Related errors


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/a8c90f8bba85d4ae. Report an issue: GitHub.