{"record":{"id":"4632651f26e89b43","repo":"openai/codex","slug":"failed-to-determine-current-user-from-environment","errorCode":null,"errorMessage":"failed to determine current user from environment: {err}","messagePattern":"failed to determine current user from environment: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/cli/src/sandbox_setup.rs","lineNumber":139,"sourceCode":"        identity.real_user,\n        identity.codex_home.display()\n    );\n    Ok(())\n}\n\nstruct SandboxSetupIdentity {\n    real_user: String,\n    codex_home: PathBuf,\n}\n\nfn resolve_sandbox_setup_identity(\n    cmd: &SandboxSetupCommand,\n) -> anyhow::Result<SandboxSetupIdentity> {\n    if cmd.current_user {\n        let real_user = std::env::var(\"USERNAME\")\n            .or_else(|_| std::env::var(\"USER\"))\n            .map_err(|err| {\n                anyhow::anyhow!(\"failed to determine current user from environment: {err}\")\n            })?;\n        let codex_home = match cmd.codex_home.clone() {\n            Some(codex_home) => codex_home,\n            None => find_codex_home()?.to_path_buf(),\n        };\n        return Ok(SandboxSetupIdentity {\n            real_user,\n            codex_home,\n        });\n    }\n\n    let real_user = cmd\n        .user\n        .clone()\n        .ok_or_else(|| anyhow::anyhow!(\"--user or --current-user is required\"))?;\n    let codex_home = cmd\n        .codex_home\n        .clone()","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/cli/src/sandbox_setup.rs#L121-L157","documentation":"Error \"failed to determine current user from environment: {err}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/cli/src/sandbox_setup.rs:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}