{"record":{"id":"b5447179b2313d1d","repo":"openai/codex","slug":"regcreatekeyexw-failed-status-error","errorCode":null,"errorMessage":"RegCreateKeyExW failed: {status} ({error})","messagePattern":"RegCreateKeyExW failed: (.+?) \\((.+?)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/windows-sandbox-rs/src/hide_users.rs","lineNumber":124,"sourceCode":"\nfn create_userlist_key() -> anyhow::Result<HKEY> {\n    let key_path = to_wide(USERLIST_KEY_PATH);\n    let mut key: HKEY = 0;\n    let status = unsafe {\n        RegCreateKeyExW(\n            HKEY_LOCAL_MACHINE,\n            key_path.as_ptr(),\n            0,\n            std::ptr::null_mut(),\n            REG_OPTION_NON_VOLATILE,\n            KEY_WRITE,\n            std::ptr::null_mut(),\n            &mut key,\n            std::ptr::null_mut(),\n        )\n    };\n    if status != 0 {\n        return Err(anyhow!(\n            \"RegCreateKeyExW failed: {status} ({error})\",\n            error = format_last_error(status as i32)\n        ));\n    }\n    Ok(key)\n}\n\n/// Sets HIDDEN|SYSTEM on `path` if needed, returning whether it changed anything.\nfn hide_directory(path: &Path) -> anyhow::Result<bool> {\n    let wide = to_wide(path);\n    let attrs = unsafe { GetFileAttributesW(wide.as_ptr()) };\n    if attrs == INVALID_FILE_ATTRIBUTES {\n        let err = unsafe { GetLastError() } as i32;\n        return Err(anyhow!(\n            \"GetFileAttributesW failed for {}: {err} ({error})\",\n            path.display(),\n            error = format_last_error(err)\n        ));","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/windows-sandbox-rs/src/hide_users.rs#L106-L142","documentation":"Error \"RegCreateKeyExW failed: {status} ({error})\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/windows-sandbox-rs/src/hide_users.rs:124 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"}