openai/codex · error · anyhow::Error
only restricted managed filesystem permissions can be…
Error message
only restricted managed filesystem permissions can be enforced by the Windows sandbox
What it means
Guard in token_mode_for_permission_profile: only restricted (non-full-disk-write) managed filesystem permissions are enforceable; the resolved profile's filesystem permissions fall outside what the Windows sandbox can enforce, so no token mode can be chosen.
Solutions
- Use a managed profile with restricted filesystem permissions
- Narrow full-disk write requests to explicit writable roots
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/windows-sandbox-rs/src/resolved_permissions.rs:70 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/81b0aabc846bc5c1.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/windows-sandbox-rs/src/resolved_permissions.rs:70
);
}
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(
permission_profile: &PermissionProfile,
workspace_roots: &[AbsolutePathBuf],
) -> Result<Self> {
let mut permissions = Self::try_from_permission_profile(permission_profile)?;
permissions.file_system = permissions
.file_systemView on GitHub (pinned to 339751715c)