{"record":{"id":"81b0aabc846bc5c1","repo":"openai/codex","slug":"only-restricted-managed-filesystem-permissions-can","errorCode":null,"errorMessage":"only restricted managed filesystem permissions can be enforced by the Windows sandbox","messagePattern":"only restricted managed filesystem permissions can be enforced by the Windows sandbox","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/resolved_permissions.rs","lineNumber":70,"sourceCode":"        );\n    }\n    if permissions.writable_roots_for_cwd(cwd, env_map).is_empty() {\n        Ok(WindowsSandboxTokenMode::ReadOnlyCapability)\n    } else {\n        Ok(WindowsSandboxTokenMode::WritableRootsCapability)\n    }\n}\n\nimpl ResolvedWindowsSandboxPermissions {\n    pub fn try_from_permission_profile(permission_profile: &PermissionProfile) -> Result<Self> {\n        if !matches!(permission_profile, PermissionProfile::Managed { .. }) {\n            anyhow::bail!(\n                \"only managed permission profiles can be enforced by the Windows sandbox\"\n            );\n        }\n        let (file_system, network) = permission_profile.to_runtime_permissions();\n        if !matches!(file_system.kind, FileSystemSandboxKind::Restricted) {\n            anyhow::bail!(\n                \"only restricted managed filesystem permissions can be enforced by the Windows sandbox\"\n            );\n        }\n        Ok(Self {\n            file_system,\n            network,\n        })\n    }\n\n    /// Resolves a managed permission profile and binds symbolic `:workspace_roots`\n    /// entries to the workspace roots supplied by the caller.\n    pub fn try_from_permission_profile_for_workspace_roots(\n        permission_profile: &PermissionProfile,\n        workspace_roots: &[AbsolutePathBuf],\n    ) -> Result<Self> {\n        let mut permissions = Self::try_from_permission_profile(permission_profile)?;\n        permissions.file_system = permissions\n            .file_system","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/resolved_permissions.rs#L52-L88","documentation":"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.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/resolved_permissions.rs:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a managed profile with restricted filesystem permissions","Narrow full-disk write requests to explicit writable roots"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}