openai/codex · error · ExecPolicyError
failed to read rules files from
Error message
failed to read rules files from {dir}: {source} What it means
ExecPolicyError::ReadDir — loading exec policy rules failed because the rules directory could not be listed (permission, missing dir, or IO failure). The directory path and the source IO error are carried in the error for diagnosis.
Solutions
- Check that the rules directory {dir} exists and is readable.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/core/src/exec_policy.rs:240 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/6596344c372e259f.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/core/src/exec_policy.rs:240
AskForApproval::Granular(granular_config) => {
if prompt_is_rule {
if !granular_config.allows_rules_approval() {
Some(REJECT_RULES_APPROVAL_REASON)
} else {
None
}
} else if !granular_config.allows_sandbox_approval() {
Some(REJECT_SANDBOX_APPROVAL_REASON)
} else {
None
}
}
}
}
#[derive(Debug, Error)]
pub enum ExecPolicyError {
#[error("failed to read rules files from {dir}: {source}")]
ReadDir {
dir: PathBuf,
source: std::io::Error,
},
#[error("failed to read rules file {path}: {source}")]
ReadFile {
path: PathBuf,
source: std::io::Error,
},
#[error("failed to parse rules file {path}: {source}")]
ParsePolicy {
path: String,
source: codex_execpolicy::Error,
},
}
View on GitHub (pinned to 339751715c)