openai/codex · error · Error

expected every example to match at least one rule. rules

Error message

expected every example to match at least one rule. rules: {rules:?}; unmatched examples: {examples:?}

What it means

Fired during policy self-testing: one or more examples in the policy did not match any of the declared rules, so the policy fails its own coverage check. The payload lists all rules and the unmatched examples.

Solutions

  1. Add or broaden a rule so every listed example matches at least one rule
  2. Fix typos in the unmatched example strings
  3. Remove examples that are no longer relevant to the policy
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/execpolicy/src/error.rs:34 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/33245167cfbb4ae1. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/execpolicy/src/error.rs:34

}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ErrorLocation {
    pub path: String,
    pub range: TextRange,
}

#[derive(Debug, Error)]
pub enum Error {
    #[error("invalid decision: {0}")]
    InvalidDecision(String),
    #[error("invalid pattern element: {0}")]
    InvalidPattern(String),
    #[error("invalid example: {0}")]
    InvalidExample(String),
    #[error("invalid rule: {0}")]
    InvalidRule(String),
    #[error(
        "expected every example to match at least one rule. rules: {rules:?}; unmatched examples: \
         {examples:?}"
    )]
    ExampleDidNotMatch {
        rules: Vec<String>,
        examples: Vec<String>,
        location: Option<ErrorLocation>,
    },
    #[error("expected example to not match rule `{rule}`: {example}")]
    ExampleDidMatch {
        rule: String,
        example: String,
        location: Option<ErrorLocation>,
    },
    #[error("starlark error: {0}")]
    Starlark(StarlarkError),
}

View on GitHub (pinned to 339751715c)