openai/codex · error · anyhow::Error

sandbox provisioning succeeded, but failed to persist…

Error message

sandbox provisioning succeeded, but failed to persist elevated sandbox config: {err}

What it means

run_elevated post-setup persistence: Windows sandbox provisioning completed, but writing windows_sandbox_mode="elevated" to the target user's config via ConfigEditsBuilder failed (err). The system is provisioned but not configured.

Solutions

  1. Inspect {err} for the config write failure
  2. Check write permissions on the target CODEX_HOME
  3. Set windows_sandbox_mode = "elevated" manually in the user's config.toml
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at codex-rs/cli/src/sandbox_setup.rs:114 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/8ddb5a9a17683022. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/cli/src/sandbox_setup.rs:114

            config_profile.as_ref(),
            &identity.codex_home,
        ))
        .cli_overrides(cli_overrides)
        .build()
        .await
        .context("failed to load target user's Codex config for sandbox provisioning")?;

    codex_core::windows_sandbox::run_elevated_provisioning_setup(
        identity.codex_home.as_path(),
        identity.real_user.as_str(),
        config.permissions.network.as_ref(),
    )?;
    ConfigEditsBuilder::new(identity.codex_home.as_path())
        .set_windows_sandbox_mode("elevated")
        .apply()
        .await
        .map_err(|err| {
            anyhow::anyhow!(
                "sandbox provisioning succeeded, but failed to persist elevated sandbox config: {err}"
            )
        })?;

    println!(
        "Windows elevated sandbox setup completed for {} at {}.",
        identity.real_user,
        identity.codex_home.display()
    );
    Ok(())
}

struct SandboxSetupIdentity {
    real_user: String,
    codex_home: PathBuf,
}

fn resolve_sandbox_setup_identity(

View on GitHub (pinned to 339751715c)