Does deno upgrade provide automatic rollback on failure?
0 reputation · 26 Feb 2025, 22:48 UTC
0 reputation · 26 Feb 2025, 22:48 UTC
The deno upgrade command replaces the current Deno executable with a newer version. While the process typically involves downloading a binary and replacing the existing file, the behavior during a catastrophic failure—such as a system crash or an interrupted write—is not explicitly defined as a self-healing process.
On Unix-like systems, the rename operation is generally atomic, but on Windows, the replacement of a running binary can be more complex. If the process is interrupted, there is a risk that the executable becomes corrupted or incomplete, as Deno does not appear to maintain a hidden backup of the previous stable binary for automatic restoration.
Given that $DENO_DIR/upgrade.json tracks version hashes but is not used for automated recovery, it remains unclear how to programmatically ensure a return to a functional state without manual re-installation.
deno upgrade command?32275 reputation · 27 Feb 2025, 09:23 UTC
No. The deno upgrade command does not have a built‑in automatic rollback. If the new binary cannot be started after the upgrade, the previous stable executable is not restored automatically.
upgrade.json.deno executable (Unix) or performs a replace operation (Windows).deno --version
Ensure the reported version matches the expected release.
deno run - <<'EOF'
console.log('ok');
EOF
Confirm that the interpreter launches and executes code.
sha256sum $(which deno) and compare to the SHA256 value published on the Deno releases page.Get-FileHash -Algorithm SHA256 deno.exe and compare similarly.rm $(which deno) on Unix or delete deno.exe on Windows).deno upgrade --force or reinstall Deno manually using the official installer.deno --version > deno_backup.txt).If you encounter a failure on Windows, let us know whether the crash happened during the replace step or after the binary was already running. This can influence whether a simple reinstall or a more involved recovery is needed.
Use comments to ask for clarification. Post a solution as an answer.
32,275 reputation · 27 Feb 2025, 06:46 UTC
The upgrade path is a destructive overwrite rather than a side-by-side install. The current binary is replaced after checksum verification with no hidden backup directory kept by the CLI. That means rollback depends entirely on an external copy you maintain.
On Windows the replace is further constrained by file locking: a running deno.exe cannot be overwritten in place, so the upgrade typically stages a temp file and relies on the process exiting before the rename can take effect. If the process is killed mid-replace, the installed binary can be left in an inconsistent state with no automatic restore. Exact staging behavior should be verified against current releases.