openai/codex · error · ExecPolicyUpdateError

failed to update in-memory rules

Error message

failed to update in-memory rules: {source}

What it means

ExecPolicyUpdateError::AddRule — after the on-disk append, updating the in-memory policy with the new rule failed (the ExecPolicyError source is embedded). The file may have changed but the live policy did not, leaving them out of sync.

Solutions

  1. Retry the rules update; check the underlying error for the in-memory rules engine.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/core/src/exec_policy.rs:267 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/338cbf91ab1cd6bd. Report an issue: GitHub.

Appendix: source

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

        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}")]
    JoinBlockingTask { source: tokio::task::JoinError },

    #[error("failed to update in-memory rules: {source}")]
    AddRule {
        #[from]
        source: ExecPolicyRuleError,
    },
}

pub(crate) struct ExecPolicyManager {
    policy: ArcSwap<Policy>,
    update_lock: Semaphore,
}

pub(crate) struct ExecApprovalRequest<'a> {
    pub(crate) command: &'a [String],
    pub(crate) approval_policy: AskForApproval,
    pub(crate) permission_profile: PermissionProfile,
    pub(crate) environment_policy: Option<&'a RequirementsExecPolicy>,
    pub(crate) windows_sandbox_level: WindowsSandboxLevel,
    pub(crate) sandbox_permissions: SandboxPermissions,

View on GitHub (pinned to 339751715c)