openai/codex · error · ExecPolicyError

failed to read rules files from {dir}: {source}

Error message

failed to read rules files from {dir}: {source}

What it means

Error "failed to read rules files from {dir}: {source}" thrown in openai/codex.

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)

Solutions

  1. Check that the rules directory {dir} exists and is readable.

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.