coreybutler/nvm-windows · error
error: failed to copy update.exe: %v
Error message
error: failed to copy update.exe: %v
What it means
After the new files are copied into the install directory, nvm-windows copies update.exe from the extracted assets into the hidden .update subfolder so post-update steps can run it. This error means that copyFile failed — almost always because the source update.exe does not exist at that moment (asset download failed earlier, error 44) or the .update directory could not be written. It is followed by os.Exit(1), a hard abort.
Source
Thrown at src/upgrade/upgrade.go:508
err = nvmtestcmd.Run()
if err != nil {
status <- Status{Err: err}
}
}
// Debugging
if verbose {
tree(currentPath, "final directory contents:")
}
// Hide the update directory
setHidden(filepath.Join(currentPath, ".update"))
// If an "update.exe" exists, run it
if fsutil.IsExecutable(filepath.Join(tmp, "assets", "update.exe")) {
err = copyFile(filepath.Join(tmp, "assets", "update.exe"), filepath.Join(currentPath, ".update", "update.exe"))
if err != nil {
status <- Status{Err: fmt.Errorf("error: failed to copy update.exe: %v\n", err)}
os.Exit(1)
}
}
autoupdate(status)
return nil
}
type Status struct {
Text string
Err error
Done bool
Help bool
Cancel bool
Warn string
}
View on GitHub (pinned to 5b18223ca1)
Solutions
- Re-run the upgrade ensuring the update.exe asset downloads correctly (fix any network/proxy issue from the earlier asset error).
- Kill any lingering update.exe / nvm.exe processes in Task Manager before upgrading.
- Run the upgrade as Administrator so .update under NVM_HOME is writable.
- If NVM_HOME/.update is corrupt, delete it manually and retry.
Defensive patterns
Strategy: validation
Validate before calling
// Confirm update.exe arrived before the copy step
if _, err := os.Stat(filepath.Join(tmp, "assets", "update.exe")); err != nil {
return fmt.Errorf("update.exe missing from downloaded assets; aborting before os.Exit path")
} Try / catch
This path ends in os.Exit(1) — catch upstream by validating the file exists first, since after Exit no cleanup (deferred RemoveAll) runs.
Prevention
- Abort the upgrade when any earlier asset download fails instead of continuing.
- Kill stale update.exe processes from prior upgrades.
- Run elevated so .update is writable.
When it happens
Trigger: update.exe was never downloaded (asset download error was sent to status but the flow continued); .update directory creation (os.MkdirAll earlier) failed silently since its error is ignored; target file locked by a previous nvm process still holding .update/update.exe; permissions on NVM_HOME.
Common situations: Upgrade flow continuing after an earlier per-asset download failure because the loop does not abort; leftover update.exe running from a prior interrupted upgrade; non-admin install into a protected directory.
Related errors
- error: failed to create backup directory: %v
- failed to open source file: %v
- failed to create destination file: %v
- failed to create destination directory %s: %v
- failed to get relative path for %s: %v
AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15).
Data as JSON: /api/errors/cdf7f6d00dc54a72.
Report an issue: GitHub.