openai/codex · error · anyhow::Error

OSS provider not set but oss flag was used

Error message

OSS provider not set but oss flag was used

What it means

Defensive guard in run_exec_session: the --oss flag was set but model_provider is None. Under normal flag handling this cannot happen; it means upstream provider resolution silently failed and the session cannot start without a provider id.

Solutions

  1. Configure an OSS provider before using the --oss flag.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/exec/src/lib.rs:696 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at codex-rs/exec/src/lib.rs:696

        thread_source,
    } = args;

    let mut event_processor: Box<dyn EventProcessor> = match json_mode {
        true => Box::new(EventProcessorWithJsonOutput::new(last_message_file.clone())),
        _ => Box::new(EventProcessorWithHumanOutput::create_with_ansi(
            stderr_with_ansi,
            &config,
            last_message_file.clone(),
        )),
    };
    if oss {
        // We're in the oss section, so provider_id should be Some
        // Let's handle None case gracefully though just in case
        let provider_id = match model_provider.as_ref() {
            Some(id) => id,
            None => {
                error!("OSS provider unexpectedly not set when oss flag is used");
                return Err(anyhow::anyhow!(
                    "OSS provider not set but oss flag was used"
                ));
            }
        };
        ensure_oss_provider_ready(provider_id, &config)
            .await
            .map_err(|e| anyhow::anyhow!("OSS setup failed: {e}"))?;
    }

    let default_cwd = config.cwd.to_path_buf();
    let default_approval_policy = config.permissions.approval_policy.value();
    let default_effort = config.model_reasoning_effort.clone();

    let (initial_operation, prompt_summary) = match (command.as_ref(), prompt, images) {
        (Some(ExecCommand::Review(review_cli)), _, _) => {
            let review_request = build_review_request(review_cli)?;
            let summary = codex_core::review_prompts::user_facing_hint(&review_request.target);
            (InitialOperation::Review { review_request }, summary)

View on GitHub (pinned to 339751715c)