BigPizzaV3/CodexPlusPlus · error · anyhow::Error

invalid runtime file path

Error message

invalid runtime file path

What it means

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.

Source

Thrown at crates/codex-plus-core/src/computer_use_guard.rs:440

        return Ok(None);
    };
    if exports.contains_key(SKY_INTERNAL_COMPUTER_USE_CLIENT_EXPORT) {
        return Ok(None);
    }
    exports.insert(
        SKY_INTERNAL_COMPUTER_USE_CLIENT_EXPORT.to_string(),
        serde_json::Value::String(SKY_INTERNAL_COMPUTER_USE_CLIENT_EXPORT.to_string()),
    );
    let mut updated = serde_json::to_string_pretty(&package)?;
    updated.push('\n');
    Ok(Some(updated))
}

#[cfg(windows)]
fn atomic_write_runtime_file(path: &Path, bytes: &[u8]) -> anyhow::Result<()> {
    let parent = path
        .parent()
        .ok_or_else(|| anyhow::anyhow!("invalid runtime file path"))?;
    let temp = parent.join(format!(
        ".{}.codexpp-tmp",
        path.file_name()
            .and_then(|value| value.to_str())
            .unwrap_or("package.json")
    ));
    std::fs::write(&temp, bytes).with_context(|| format!("failed to write {}", temp.display()))?;
    match std::fs::rename(&temp, path) {
        Ok(()) => Ok(()),
        Err(error) => {
            let _ = std::fs::remove_file(&temp);
            Err(error).with_context(|| format!("failed to replace {}", path.display()))
        }
    }
}

#[cfg(windows)]
pub(crate) fn ensure_openai_bundled_marketplace(home: &Path) -> anyhow::Result<Option<PathBuf>> {

View on GitHub (pinned to 1f431ae49b)

Solutions

  1. Log the exact path handed to atomic_write_runtime_file — it will be '' or '/'
  2. Fix the upstream resolution that produced the degenerate runtime file path (install dir / home dir detection)
  3. Treat occurrences as a bug report against path resolution, not as an environment problem
Defensive patterns

Strategy: validation

Validate before calling

// Windows pre-flight for any atomic_write target
fn writable_target(p: &std::path::Path) -> bool {
    p.parent().is_some_and(|d| d.try_exists().unwrap_or(false))
}
ensure!(writable_target(&package_json_path), "bad runtime file path");

Type guard

fn path_has_parent(p: &std::path::Path) -> bool { p.parent().is_some() }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@1f431ae49b (2026-08-16). Data as JSON: /api/errors/4e7a3115b3aa16d3. Report an issue: GitHub.