openai/codex · error · ExecPolicyError

failed to read rules file

Error message

failed to read rules file {path}: {source}

What it means

ExecPolicyError::ReadFile: an I/O error occurred while reading a single exec-policy rules file at `path`. The std::io::Error source explains why (permissions, disappearance, etc.); policy evaluation/setup cannot proceed with unreadable rules.

Solutions

  1. Check that the rules file {path} exists and is readable.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/core/src/exec_policy.rs:246 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/3c4e901ad158f66d. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/core/src/exec_policy.rs:246

                }
            } 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,
    },
}

#[derive(Debug, Error)]
pub enum ExecPolicyUpdateError {
    #[error("failed to update rules file {path}: {source}")]
    AppendRule { path: PathBuf, source: AmendError },

    #[error("failed to join blocking rules update task: {source}")]

View on GitHub (pinned to 339751715c)