openai/codex · error · ConstraintError

To use model ` `, you need to use auto review.

Error message

To use model `{model}`, you need to use auto review.

What it means

ConstraintError::AutoReviewRequired (codex-rs/config/src/constraint.rs:19) fires when a requirements layer restricts a model so it may only be used together with auto review (the automatic approvals-reviewer mode). Selecting that model without auto review enabled fails config assembly rather than silently downgrading the safety requirement.

Solutions

  1. Enable auto review for the run (set the approvals reviewer to auto) and retry
  2. Or switch to a model that is not gated by the auto-review requirement
  3. Or ask the requirements owner to lift the auto-review constraint for that model

Example fix

# before
model = "gpt-5.1-codex-max"
# (auto review not configured)

# after
model = "gpt-5.1-codex-max"
approvals_reviewer = "auto"
Defensive patterns

Strategy: try-catch

Validate before calling

// If requirements are introspectable, gate the model pick up front:
if model_requires_auto_review(&requirements, &model)? && !auto_review_enabled {
    return Err("enable auto review or pick another model".into());
}

Try / catch

match assemble_config(...) {
    Err(ConstraintError::AutoReviewRequired { model }) => {
        prompt_user(format!("{model} requires auto review; enable it or pick another model"));
    }
    r => r?,
}

Prevention

When it happens

Trigger: Setting model via config.toml, the -m flag, or an API override to a model whose requirement enforces auto review, while the approvals reviewer is not set to auto; the model constraint validator returns AutoReviewRequired during config load or set.

Common situations: Orgs gate high-autonomy models behind automatic code review; users pin such a model in a dotfiles-shared config that does not enable auto review; profiles copied between machines where the reviewer setting differs.

Related errors


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

Appendix: source

Thrown at codex-rs/config/src/constraint.rs:19

use std::fmt;
use std::sync::Arc;

use crate::config_requirements::RequirementSource;
use thiserror::Error;

#[derive(Debug, Error, PartialEq, Eq)]
pub enum ConstraintError {
    #[error(
        "invalid value for `{field_name}`: `{candidate}` is not in the allowed set {allowed} (set by {requirement_source})"
    )]
    InvalidValue {
        field_name: &'static str,
        candidate: String,
        allowed: String,
        requirement_source: RequirementSource,
    },

    #[error("To use model `{model}`, you need to use auto review.")]
    AutoReviewRequired { model: String },

    #[error("field `{field_name}` cannot be empty")]
    EmptyField { field_name: String },

    #[error("invalid rules in requirements (set by {requirement_source}): {reason}")]
    ExecPolicyParse {
        requirement_source: RequirementSource,
        reason: String,
    },

    #[error(
        "invalid requirement for MCP server `{server_name}` (set by {requirement_source}): {reason}"
    )]
    McpServerRequirementParse {
        server_name: String,
        requirement_source: RequirementSource,
        reason: String,

View on GitHub (pinned to 339751715c)