denoland/deno · error · AnyError

Failed to validate Deno executable. This may be because your

Error message

Failed to validate Deno executable. This may be because your OS is unsupported or the executable is corrupted

What it means

After downloading and installing a new binary, Deno sanity-checks it by executing `<exe> -V`. If that child process cannot run successfully (non-zero exit or spawn failure beyond the initial io error context), the upgrade fails with this message. It catches corrupted archives that still passed checksum-less paths (e.g. PR/branch artifacts) and binaries that cannot execute on the current OS.

Source

Thrown at cli/tools/upgrade.rs:2045

      concat!(
        "You don't have write permission to {} because it's owned by root.\n",
        "Consider updating deno through your package manager if its installed from it.\n",
        "Otherwise run `deno upgrade` as root.",
      ),
      output_exe_path.display()
    );
  }
  Ok(permissions)
}

fn check_exe(exe_path: &Path) -> Result<(), AnyError> {
  let output = Command::new(exe_path)
    .arg("-V")
    .stderr(std::process::Stdio::inherit())
    .output()
    .with_context(|| format!("failed to run '{}'", exe_path.display()))?;
  if !output.status.success() {
    bail!(
      "Failed to validate Deno executable. This may be because your OS is unsupported or the executable is corrupted"
    )
  } else {
    Ok(())
  }
}

#[derive(Debug)]
struct CheckVersionFile {
  pub last_prompt: chrono::DateTime<chrono::Utc>,
  pub last_checked: chrono::DateTime<chrono::Utc>,
  pub current_version: String,
  pub latest_version: String,
  pub current_release_channel: ReleaseChannel,
}

impl CheckVersionFile {
  pub fn parse(content: String) -> Option<Self> {

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Run `<deno-path> -V` yourself to see the concrete spawn/exec failure (missing loader, format error, permission denied).
  2. Verify the artifact matches your platform (os/arch) — for PR/branch installs prefer artifacts labeled for your target or build locally.
  3. Re-run the upgrade to rule out a corrupted write; check disk space and temp-dir health.
  4. On macOS, clear quarantine (`xattr -d com.apple.quarantine <path>`) if Gatekeeper is the blocker.

Example fix

# before
deno upgrade --pr 12345  # Failed to validate Deno executable...

# after: diagnose the exec failure directly
./target/deno -V            # observe the real error (format/ABI/loader)
uname -m                    # confirm host arch matches the artifact
# if mismatched: build from source
git fetch origin pull/12345/head && cargo build --bin deno
Defensive patterns

Strategy: fallback

Validate before calling

# smoke-test the binary path after any upgrade
new_bin="${1:-$(command -v deno)}"
"$new_bin" -V >/dev/null 2>&1 || { echo "binary does not run on this platform"; exit 1; }

Try / catch

deno upgrade --pr 12345 2>err.log || { grep -q 'Failed to validate Deno executable' err.log && cargo build --bin deno; }

Prevention

When it happens

Trigger: PR/branch flow where a downloaded artifact is corrupt or built for another platform (check_exe runs in both PR and branch upgrade paths); a binary missing dynamic-loader/libs for the OS; exec bits or quarantine attributes preventing execution; the `output.status.success()` check failing at cli/tools/upgrade.rs:2045.

Common situations: Cross-platform confusion (arm64 binary on x86_64 host); minimal containers lacking glibc/loader for the downloaded build; macOS Gatekeeper blocking an unsigned freshly-written binary; disk issues corrupting the written file.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/0ec97f83258746e3. Report an issue: GitHub.