openai/codex · error · RequirementsExecPolicyParseError

rules prefix_rule at index

Error message

rules prefix_rule at index {rule_index} has an invalid pattern token at index {token_index}: {reason}

What it means

While tokenizing the prefix rule at {rule_index}, the token at {token_index} was invalid per the pattern grammar (bad wildcard, misplaced separator, etc.); {reason} describes the specific parse failure, and the rule is rejected with its index for easy fixing.

Solutions

  1. Correct the invalid pattern token at the reported index per the given reason.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/config/src/requirements_exec_policy.rs:66 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/cb52691c7aed7cf7. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/config/src/requirements_exec_policy.rs:66

impl RequirementsExecPolicyDecisionToml {
    fn as_decision(self) -> Decision {
        match self {
            Self::Allow => Decision::Allow,
            Self::Prompt => Decision::Prompt,
            Self::Forbidden => Decision::Forbidden,
        }
    }
}

#[derive(Debug, Error)]
pub enum RequirementsExecPolicyParseError {
    #[error("rules prefix_rules cannot be empty")]
    EmptyPrefixRules,

    #[error("rules prefix_rule at index {rule_index} has an empty pattern")]
    EmptyPattern { rule_index: usize },

    #[error(
        "rules prefix_rule at index {rule_index} has an invalid pattern token at index {token_index}: {reason}"
    )]
    InvalidPatternToken {
        rule_index: usize,
        token_index: usize,
        reason: String,
    },

    #[error("rules prefix_rule at index {rule_index} has an empty justification")]
    EmptyJustification { rule_index: usize },

    #[error("rules prefix_rule at index {rule_index} is missing a decision")]
    MissingDecision { rule_index: usize },

    #[error(
        "rules prefix_rule at index {rule_index} has decision 'allow', which is not permitted in requirements.toml: Codex merges these rules with other config and uses the most restrictive result (use 'prompt' or 'forbidden')"
    )]
    AllowDecisionNotAllowed { rule_index: usize },

View on GitHub (pinned to 339751715c)