openai/codex · error · Error
invalid pattern element
Error message
invalid pattern element: {0} What it means
Validation error fired when a pattern element within a rule is not a recognized element kind (e.g. an unexpected token or malformed glob component). The payload names the invalid element; the input at fault is the rule pattern in the policy.
Solutions
- Fix the pattern element in the policy rule to use supported syntax (literals, globs, recognized placeholders)
- Check for typos or unsupported wildcards in the pattern
- Consult execpolicy pattern documentation for valid element forms
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/execpolicy/src/error.rs:28 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/c6ba927dc9f694b7.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/execpolicy/src/error.rs:28
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct TextRange {
pub start: TextPosition,
pub end: TextPosition,
}
#[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,View on GitHub (pinned to 339751715c)