openai/codex · error

convert write root capability SID failed

Error message

convert write root capability SID failed

What it means

Sentinel error: converting the workspace write-root capability SID string (produced by workspace_write_cap_sid_for_root) into a PSID failed during write-root ACL processing. The chained error identifies the failed conversion; processing stops because grant entries cannot be built without valid PSIDs.

Solutions

  1. Inspect the chained ConvertStringSidToSidW error and GetLastError
  2. Verify the capability SID derivation (based on codex home and command cwd) produced a valid S-1-... string
  3. Re-run setup after correcting the write-root configuration so the SID source data is consistent
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs:870 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/f2859436fc3d7051. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/windows-sandbox-rs/src/bin/setup_main/win.rs:870

    let mut seen_deny_paths: HashSet<PathBuf> = HashSet::new();
    let mut seen_write_roots: HashSet<PathBuf> = HashSet::new();
    for root in &payload.write_roots {
        if !seen_write_roots.insert(root.clone()) {
            continue;
        }
        if !root.exists() {
            log_line(
                log,
                &format!("write root {} missing; skipping", root.display()),
            )?;
            continue;
        }
        let root_cap_sid_str =
            workspace_write_cap_sid_for_root(&payload.codex_home, &payload.command_cwd, root)?;
        let root_cap_psid = unsafe {
            convert_string_sid_to_sid(&root_cap_sid_str)
                .ok_or_else(|| anyhow::anyhow!("convert write root capability SID failed"))?
        };
        let need_grant =
            match path_write_aces_need_refresh(root, &[sandbox_group_psid, root_cap_psid]) {
                Ok(needs_refresh) => needs_refresh,
                Err(e) => {
                    refresh_errors.push(format!(
                        "write ACE check failed on {}: {}",
                        root.display(),
                        e
                    ));
                    log_line(
                        log,
                        &format!(
                            "write ACE check failed on {}: {}; continuing",
                            root.display(),
                            e
                        ),
                    )?;

View on GitHub (pinned to 339751715c)