denoland/deno · error
LAUFEY cache dir has no parent
Error message
LAUFEY cache dir has no parent: {} What it means
Before extracting the downloaded laufey archive, the code creates the parent of the target cache directory with fs::create_dir_all(parent). Path::parent() returns None only for paths with no parent component — the filesystem root '/' or a bare prefix like 'laufey:' on Windows — so this error signals a degenerate cache-directory path rather than a normal missing directory.
Solutions
- Check the cache-related environment variables (e.g. DENO_DIR) in the failing shell and make sure they point at a normal directory like ~/.cache/deno.
- Unset the offending variable and let deno pick its default cache location.
- If it persists with defaults, inspect how the cache path is derived for your platform and report it as a bug.
Example fix
# before export DENO_DIR=/ # cache dir collapses to a parentless path # error: LAUFEY cache dir has no parent: / # after unset DENO_DIR # or: export DENO_DIR="$HOME/.cache/deno"
Defensive patterns
Strategy: validation
Validate before calling
# Validate the cache root before running: it must be a normal, parented directory
case "${DENO_DIR:-$HOME/.cache/deno}" in
/|""|*[!/]/*/) ;;
*) test -d "${DENO_DIR:-$HOME/.cache/deno}" || echo "cache dir missing (will be created)" ;;
esac
# simplest guard: refuse degenerate values
test "${DENO_DIR:-x}" != "/" || { echo 'DENO_DIR must not be /'; exit 1; } Prevention
- Never point DENO_DIR (or any cache env var) at the filesystem root.
- In containers, ensure HOME is set so the default cache path resolves under a real directory.
- Treat this error as a configuration smell: it cannot come from the network or the archive.
When it happens
Trigger: The computed laufey cache dir resolves to '/' or another parentless path, which in practice requires a broken cache-root configuration (e.g. DENO_DIR or an equivalent cache env var set to '/' or to a Windows drive prefix) rather than anything the download itself can cause.
Common situations: An env var pointing the deno cache at the filesystem root; a container image where the cache dir was computed from an unset HOME that collapsed to a degenerate path; essentially never seen with a correctly configured environment.
Related errors
- : failed to open for append
- ERR_INVALID_ARG_TYPE
- failed to atomic-rename LAUFEY cache to
- failed to open cache db at
- failed to open in-memory cache db
AI-assisted analysis of denoland/deno@f7822238ca (2026-08-20).
Data as JSON: /api/errors/7c3d7ec2cdd16a6d.
Report an issue: GitHub.
Appendix: source
Thrown at cli/tools/desktop.rs:2000
.await
.with_context(|| format!("failed to download {url}"))?;
let data = response
.into_maybe_bytes()?
.ok_or_else(|| deno_core::anyhow::anyhow!("empty response from {url}"))?;
let actual =
faster_hex::hex_string(&sha2::Sha256::digest(&data)).to_lowercase();
let expected_lc = expected.to_lowercase();
if actual != expected_lc {
// Include the URL in the bail: an attacker who poisoned a redirect
// would otherwise be invisible in the failure log.
bail!(
"checksum mismatch for {archive} (downloaded from {url})\n expected: {expected_lc}\n actual: {actual}"
);
}
let parent = dir.parent().ok_or_else(|| {
deno_core::anyhow::anyhow!(
"LAUFEY cache dir has no parent: {}",
dir.display()
)
})?;
std::fs::create_dir_all(parent)?;
// Stage extraction in a sibling tempdir so concurrent `deno desktop`
// builds don't see (or stomp on) a half-populated `dir` while one
// is mid-extract. tempfile's cleanup-on-drop covers panic /
// early-return paths; on the happy path we consume the TempDir via
// `into_path` so the rename below sees a real directory.
let staging = tempfile::Builder::new()
.prefix(".staging-")
.tempdir_in(parent)
.with_context(|| {
format!("failed to stage tempdir in {}", parent.display())
})?;
View on GitHub (pinned to f7822238ca)