{"record":{"id":"03d63848355b8236","repo":"openai/codex","slug":"model-provider-model-provider-id-not-found","errorCode":null,"errorMessage":"Model provider `{model_provider_id}` not found","messagePattern":"Model provider `(.+?)` not found","errorType":"validation","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/core/src/config/mod.rs","lineNumber":3700,"sourceCode":"            .clone()\n            .filter(|value| !value.is_empty());\n\n        let model_providers =\n            merge_configured_model_providers(built_in_model_providers(openai_base_url), cfg.model_providers)\n                .map_err(|message| std::io::Error::new(std::io::ErrorKind::InvalidData, message))?;\n\n        let model_provider_id = model_provider\n            .or(cfg.model_provider)\n            .unwrap_or_else(|| \"openai\".to_string());\n        let model_provider = model_providers\n            .get(&model_provider_id)\n            .ok_or_else(|| {\n                let message = if model_provider_id == LEGACY_OLLAMA_CHAT_PROVIDER_ID {\n                    OLLAMA_CHAT_PROVIDER_REMOVED_ERROR.to_string()\n                } else {\n                    format!(\"Model provider `{model_provider_id}` not found\")\n                };\n                std::io::Error::new(std::io::ErrorKind::NotFound, message)\n            })?\n            .clone();\n\n        let shell_environment_policy = cfg.shell_environment_policy.into();\n        let allow_login_shell = cfg.allow_login_shell.unwrap_or(true);\n\n        let history = cfg.history.unwrap_or_default();\n\n        if multi_agent_v2.max_concurrent_threads_per_session == 0 {\n            return Err(std::io::Error::new(\n                std::io::ErrorKind::InvalidInput,\n                \"features.multi_agent_v2.max_concurrent_threads_per_session must be at least 1\",\n            ));\n        }\n        validate_multi_agent_v2_wait_timeout(\n            \"features.multi_agent_v2.min_wait_timeout_ms\",\n            multi_agent_v2.min_wait_timeout_ms,\n        )?;","sourceCodeStart":3682,"sourceCodeEnd":3718,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/core/src/config/mod.rs#L3682-L3718","documentation":"Config resolves the active provider id (a model_provider override, else cfg.model_provider, else \"openai\") and looks it up in the provider map built from built_in_model_providers() merged with `[model_providers]` tables across layers. An unknown id returns ErrorKind::NotFound with `Model provider` <id> `not found`. The removed legacy id `ollama_chat` instead produces a dedicated removal message explaining the current Ollama setup.","triggerScenarios":"model_provider = \"my-proxy\" with no matching `[model_providers.my-proxy]` table; a typo or case mismatch in the id; the table defined in a layer that is not loaded (different CODEX_HOME, inactive profile file); model_provider = \"ollama_chat\" after that provider's removal.","commonSituations":"Moving between machines where custom providers live in different config files; renaming or deleting a provider table while model_provider still points at it; forgetting `--profile` so the profile file defining the provider is not loaded; Ollama users upgrading.","solutions":["Define the table in a loaded layer: `[model_providers.my-proxy]` with `name`, `base_url`, and `env_key` (plus `wire_api` if needed).","Fix the id so it exactly matches the table name or a built-in provider id.","For `ollama_chat`, follow the migration described in the removal message to the current Ollama provider.","Confirm the right CODEX_HOME and profile are active, then retry."],"exampleFix":"# before\nmodel_provider = \"my-proxy\"\n\n# after\nmodel_provider = \"my-proxy\"\n\n[model_providers.my-proxy]\nname = \"My proxy\"\nbase_url = \"https://api.example.com/v1\"\nenv_key = \"MY_PROXY_API_KEY\"","handlingStrategy":"validation","validationCode":"# Pre-flight: provider id must be configured or built-in\nimport tomllib\ncfg = tomllib.load(open(\"config.toml\", \"rb\"))\nprovider_id = cfg.get(\"model_provider\", \"openai\")\nconfigured = set(cfg.get(\"model_providers\", {}))\nbuilt_ins = {\"openai\"}  # extend from built_in_model_providers() for your codex version\nassert provider_id in configured | built_ins, f\"Model provider `{provider_id}` not found\"","typeGuard":null,"tryCatchPattern":"match config_result {\n    Err(ref e) if e.kind() == std::io::ErrorKind::NotFound\n        && e.to_string().contains(\"Model provider\") => {\n        // list built-in and configured provider ids for the user\n    }\n    other => other,\n}","preventionTips":["Define [model_providers.<id>] in the same layer that sets model_provider","Keep provider ids exact; they are case-sensitive table names","Run codex configs through schema validation in CI","When deleting a provider table, grep for lingering model_provider references"],"tags":["codex","model-provider","config","ollama","not-found"],"backgroundTag":"unknown-provider-id","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}