{"record":{"id":"4e7a3115b3aa16d3","repo":"BigPizzaV3/CodexPlusPlus","slug":"invalid-runtime-file-path","errorCode":null,"errorMessage":"invalid runtime file path","messagePattern":"invalid runtime file path","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/computer_use_guard.rs","lineNumber":440,"sourceCode":"        return Ok(None);\n    };\n    if exports.contains_key(SKY_INTERNAL_COMPUTER_USE_CLIENT_EXPORT) {\n        return Ok(None);\n    }\n    exports.insert(\n        SKY_INTERNAL_COMPUTER_USE_CLIENT_EXPORT.to_string(),\n        serde_json::Value::String(SKY_INTERNAL_COMPUTER_USE_CLIENT_EXPORT.to_string()),\n    );\n    let mut updated = serde_json::to_string_pretty(&package)?;\n    updated.push('\\n');\n    Ok(Some(updated))\n}\n\n#[cfg(windows)]\nfn atomic_write_runtime_file(path: &Path, bytes: &[u8]) -> anyhow::Result<()> {\n    let parent = path\n        .parent()\n        .ok_or_else(|| anyhow::anyhow!(\"invalid runtime file path\"))?;\n    let temp = parent.join(format!(\n        \".{}.codexpp-tmp\",\n        path.file_name()\n            .and_then(|value| value.to_str())\n            .unwrap_or(\"package.json\")\n    ));\n    std::fs::write(&temp, bytes).with_context(|| format!(\"failed to write {}\", temp.display()))?;\n    match std::fs::rename(&temp, path) {\n        Ok(()) => Ok(()),\n        Err(error) => {\n            let _ = std::fs::remove_file(&temp);\n            Err(error).with_context(|| format!(\"failed to replace {}\", path.display()))\n        }\n    }\n}\n\n#[cfg(windows)]\npub(crate) fn ensure_openai_bundled_marketplace(home: &Path) -> anyhow::Result<Option<PathBuf>> {","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/1f431ae49b57b3055e0e6845ba6156c6b4232b4d/crates/codex-plus-core/src/computer_use_guard.rs#L422-L458","documentation":"atomic_write_runtime_file (crates/codex-plus-core/src/computer_use_guard.rs:440, Windows-only cfg block) writes to a temp file in path.parent() before renaming over the target. Path::parent() is None only for '' or '/', so 'invalid runtime file path' is a defensive invariant guarding the temp-file join, not something a well-formed runtime file path can produce.","triggerScenarios":"Invoking the Windows atomic write with an empty path string or '/' as the target — i.e. upstream path resolution already returned a degenerate value (misconfigured install root, empty string passed through).","commonSituations":"Practically unreachable in stock installs; surfaces only when the @oai/sky package.json path is computed from a broken home/install-dir configuration on Windows.","solutions":["Log the exact path handed to atomic_write_runtime_file — it will be '' or '/'","Fix the upstream resolution that produced the degenerate runtime file path (install dir / home dir detection)","Treat occurrences as a bug report against path resolution, not as an environment problem"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Windows pre-flight for any atomic_write target\nfn writable_target(p: &std::path::Path) -> bool {\n    p.parent().is_some_and(|d| d.try_exists().unwrap_or(false))\n}\nensure!(writable_target(&package_json_path), \"bad runtime file path\");","typeGuard":"fn path_has_parent(p: &std::path::Path) -> bool { p.parent().is_some() }","tryCatchPattern":null,"preventionTips":["Derive runtime file paths from a verified install directory, never from raw strings","Unit-test path builders to reject '' and '/' inputs","Check parent existence before any temp+rename write pattern"],"tags":["windows","atomic-write","path-validation","defensive-invariant"],"backgroundTag":"path-without-parent-directory","analyzedSha":"1f431ae49b57b3055e0e6845ba6156c6b4232b4d","analyzedAt":"2026-08-16T20:54:18.598Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}