{"record":{"id":"0ec97f83258746e3","repo":"denoland/deno","slug":"failed-to-validate-deno-executable-this-may-be-be","errorCode":null,"errorMessage":"Failed to validate Deno executable. This may be because your OS is unsupported or the executable is corrupted","messagePattern":"Failed to validate Deno executable\\. This may be because your OS is unsupported or the executable is corrupted","errorType":"exception","errorClass":"AnyError","httpStatus":null,"severity":"error","filePath":"cli/tools/upgrade.rs","lineNumber":2045,"sourceCode":"      concat!(\n        \"You don't have write permission to {} because it's owned by root.\\n\",\n        \"Consider updating deno through your package manager if its installed from it.\\n\",\n        \"Otherwise run `deno upgrade` as root.\",\n      ),\n      output_exe_path.display()\n    );\n  }\n  Ok(permissions)\n}\n\nfn check_exe(exe_path: &Path) -> Result<(), AnyError> {\n  let output = Command::new(exe_path)\n    .arg(\"-V\")\n    .stderr(std::process::Stdio::inherit())\n    .output()\n    .with_context(|| format!(\"failed to run '{}'\", exe_path.display()))?;\n  if !output.status.success() {\n    bail!(\n      \"Failed to validate Deno executable. This may be because your OS is unsupported or the executable is corrupted\"\n    )\n  } else {\n    Ok(())\n  }\n}\n\n#[derive(Debug)]\nstruct CheckVersionFile {\n  pub last_prompt: chrono::DateTime<chrono::Utc>,\n  pub last_checked: chrono::DateTime<chrono::Utc>,\n  pub current_version: String,\n  pub latest_version: String,\n  pub current_release_channel: ReleaseChannel,\n}\n\nimpl CheckVersionFile {\n  pub fn parse(content: String) -> Option<Self> {","sourceCodeStart":2027,"sourceCodeEnd":2063,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/upgrade.rs#L2027-L2063","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `<deno-path> -V` yourself to see the concrete spawn/exec failure (missing loader, format error, permission denied).","Verify the artifact matches your platform (os/arch) — for PR/branch installs prefer artifacts labeled for your target or build locally.","Re-run the upgrade to rule out a corrupted write; check disk space and temp-dir health.","On macOS, clear quarantine (`xattr -d com.apple.quarantine <path>`) if Gatekeeper is the blocker."],"exampleFix":"# before\ndeno upgrade --pr 12345  # Failed to validate Deno executable...\n\n# after: diagnose the exec failure directly\n./target/deno -V            # observe the real error (format/ABI/loader)\nuname -m                    # confirm host arch matches the artifact\n# if mismatched: build from source\ngit fetch origin pull/12345/head && cargo build --bin deno","handlingStrategy":"fallback","validationCode":"# smoke-test the binary path after any upgrade\nnew_bin=\"${1:-$(command -v deno)}\"\n\"$new_bin\" -V >/dev/null 2>&1 || { echo \"binary does not run on this platform\"; exit 1; }","typeGuard":null,"tryCatchPattern":"deno upgrade --pr 12345 2>err.log || { grep -q 'Failed to validate Deno executable' err.log && cargo build --bin deno; }","preventionTips":["Match artifact platform to host arch before PR/branch installs.","Keep runtime libs (glibc/loader) present in minimal containers.","Run `deno -V` as a post-upgrade smoke test in install scripts."],"tags":["upgrade","executable","validation","corruption","platform"],"backgroundTag":"executable-validation-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T04:17:50.494Z"}