BigPizzaV3/CodexPlusPlus · error · anyhow::Error
invalid @oai/sky package.json path
Error message
invalid @oai/sky package.json path
What it means
In the @oai/sky computer-use compatibility patcher (crates/codex-plus-core/src/computer_use_guard.rs:186), after deciding the package.json must be rewritten, the code joins the backup filename onto package_json.parent() — Path::parent() returns None only for empty paths or the filesystem root '/'. This is a defensive invariant: a real package.json path inside a runtime directory always has a parent, so hitting it means the path itself was degenerate.
Source
Thrown at crates/codex-plus-core/src/computer_use_guard.rs:186
changed: false,
package_json: Some(package_json.to_path_buf()),
backup_path: None,
});
}
let existing = std::fs::read_to_string(package_json)
.with_context(|| format!("failed to read {}", package_json.display()))?;
let Some(updated) = add_sky_internal_computer_use_export(&existing)? else {
return Ok(RuntimeCompatResult {
changed: false,
package_json: Some(package_json.to_path_buf()),
backup_path: None,
});
};
let backup_path = package_json
.parent()
.ok_or_else(|| anyhow::anyhow!("invalid @oai/sky package.json path"))?
.join(SKY_PACKAGE_EXPORTS_BACKUP);
if !backup_path.exists() {
std::fs::copy(package_json, &backup_path).with_context(|| {
format!(
"failed to back up {} to {}",
package_json.display(),
backup_path.display()
)
})?;
}
atomic_write_runtime_file(package_json, updated.as_bytes())?;
Ok(RuntimeCompatResult {
changed: true,
package_json: Some(package_json.to_path_buf()),
backup_path: Some(backup_path),
})
}
View on GitHub (pinned to 1f431ae49b)
Solutions
- Log the package_json value at the call site — it will be empty or '/' and points at the upstream path-resolution bug
- Check how the @oai/sky package location is resolved (home dir join) and ensure it yields a nested, non-root path
- Report as a bug if a stock install reproduces it — the input path should never be degenerate
Defensive patterns
Strategy: validation
Validate before calling
// Before running the guard, sanity-check the resolved runtime paths
fn runtime_paths_sane(p: &std::path::Path) -> bool {
p.is_absolute() && p.parent().is_some() && p.file_name().is_some()
}
ensure!(runtime_paths_sane(&sky_package_json), "degenerate @oai/sky path: {}", sky_package_json.display()); Type guard
fn path_has_parent(p: &std::path::Path) -> bool { p.parent().is_some() } Prevention
- Assert resolved install/home paths are non-root before joining filenames
- Fail fast at home-dir detection with a clear message instead of propagating empty strings
- Log resolved paths once at startup to catch degenerate values early
When it happens
Trigger: The guard runs with a resolved @oai/sky package.json path that is '' or '/' — e.g. a home/runtime-dir resolution bug that produced an empty string and it was then Path::new'd, or root was used as a sentinel.
Common situations: Essentially unreachable in normal operation; appears only with corrupted install paths, a misconfigured home directory pointing at root, or a code change that passes an unresolved path variable.
Related errors
- invalid bundled marketplace path
- invalid runtime file path
- throw new Error({});
- missing cached {plugin} plugin for openai-bundled marketplac
- {key} must be a TOML table
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@1f431ae49b (2026-08-16).
Data as JSON: /api/errors/d4e7f07b43bd8dac.
Report an issue: GitHub.