openai/codex · error · anyhow::Error

workspace-write sandbox has no writable root capability SIDs

Error message

workspace-write sandbox has no writable root capability SIDs

What it means

Configuration invariant violation: the permission profile resolved to workspace-write mode but no writable-root capability SIDs could be derived from the effective write roots (empty roots or SID creation failed for every root). The elevated session cannot build an ACL granting writes anywhere.

Solutions

  1. Check that write_roots_override / workspace roots are non-empty for workspace-write profiles
  2. Ensure capability SID creation under codex_home succeeded (permissions, disk space)
  3. Fall back to read-only token mode if no writable roots are actually needed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/elevated_impl.rs:173 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/4aee6421403083ea. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/elevated_impl.rs:173

            crate::WindowsSandboxProxySettingsMode::Reconcile,
        )?;
        // Build capability SID for ACL grants.
        let caps = load_or_create_cap_sids(codex_home)?;
        let (sid_for_null, cap_sids) = if permissions.uses_write_capabilities_for_cwd(cwd, &env_map)
        {
            let write_roots = effective_write_roots_for_permissions(
                &permissions,
                cwd,
                &env_map,
                codex_home,
                write_roots_override,
            );
            let cap_sids = write_roots
                .iter()
                .map(|root| workspace_write_cap_sid_for_root(codex_home, cwd, root))
                .collect::<Result<Vec<_>>>()?;
            if cap_sids.is_empty() {
                anyhow::bail!("workspace-write sandbox has no writable root capability SIDs");
            }
            (LocalSid::from_string(&cap_sids[0])?, cap_sids)
        } else {
            let sid = LocalSid::from_string(&caps.readonly)?;
            (sid, vec![caps.readonly])
        };

        unsafe {
            allow_null_device(sid_for_null.as_ptr());
        }

        (|| -> Result<CaptureResult> {
            let spawn_request = SpawnRequest {
                command: command.clone(),
                cwd: cwd.to_path_buf(),
                env: env_map.clone(),
                permission_profile: permission_profile.clone(),
                workspace_roots: workspace_roots.to_vec(),

View on GitHub (pinned to 339751715c)