openai/codex · error · anyhow::Error

only managed permission profiles can be enforced by the…

Error message

only managed permission profiles can be enforced by the Windows sandbox

What it means

Guard in try_from_permission_profile: the given PermissionProfile is not the Managed variant (e.g., a danger-full-access or custom profile), and the Windows sandbox can only enforce managed permission profiles, so conversion fails.

Solutions

  1. Pass a Managed permission profile when using the Windows sandbox
  2. Run non-managed profiles through a backend that supports them
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/resolved_permissions.rs:64 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/d1e1bab722dc68df. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/resolved_permissions.rs:64

            permission_profile,
            workspace_roots,
        )?;
    if permissions.file_system.has_full_disk_write_access() {
        anyhow::bail!(
            "permission profile requests full-disk filesystem writes, which cannot be enforced by the Windows sandbox"
        );
    }
    if permissions.writable_roots_for_cwd(cwd, env_map).is_empty() {
        Ok(WindowsSandboxTokenMode::ReadOnlyCapability)
    } else {
        Ok(WindowsSandboxTokenMode::WritableRootsCapability)
    }
}

impl ResolvedWindowsSandboxPermissions {
    pub fn try_from_permission_profile(permission_profile: &PermissionProfile) -> Result<Self> {
        if !matches!(permission_profile, PermissionProfile::Managed { .. }) {
            anyhow::bail!(
                "only managed permission profiles can be enforced by the Windows sandbox"
            );
        }
        let (file_system, network) = permission_profile.to_runtime_permissions();
        if !matches!(file_system.kind, FileSystemSandboxKind::Restricted) {
            anyhow::bail!(
                "only restricted managed filesystem permissions can be enforced by the Windows sandbox"
            );
        }
        Ok(Self {
            file_system,
            network,
        })
    }

    /// Resolves a managed permission profile and binds symbolic `:workspace_roots`
    /// entries to the workspace roots supplied by the caller.
    pub fn try_from_permission_profile_for_workspace_roots(

View on GitHub (pinned to 339751715c)