Skip to content

fix(update): rename hermes.exe before uv/pip install on Windows - #23408

Closed
uzunkuyruk wants to merge 1 commit into
NousResearch:mainfrom
uzunkuyruk:fix/windows-update-exe-rename
Closed

fix(update): rename hermes.exe before uv/pip install on Windows#23408
uzunkuyruk wants to merge 1 commit into
NousResearch:mainfrom
uzunkuyruk:fix/windows-update-exe-rename

Conversation

@uzunkuyruk

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes hermes update failing on Windows with Access is denied (os error 5) when uv pip install -e . tries to overwrite the active hermes.exe in venv/Scripts/.

Windows holds a file lock on any running .exe, preventing it from being overwritten. The fix renames hermes.exe to hermes.exe.old before the install step — Windows allows renaming an open executable in place, which releases the write lock so the installer can write a fresh hermes.exe. The .old file is cleaned up in a finally block after the install completes (success or failure).

Two helper functions added to hermes_cli/main.py:

  • _rename_active_windows_exe() — renames venv/Scripts/hermes.exe to .old before install; no-op on non-Windows
  • _cleanup_windows_exe_old() — removes the .old backup; called in finally so it always runs

No-op on Linux/macOS. No behavior change on non-Windows platforms.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

References

Fixes #23327

Checklist

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • My PR contains only changes related to this fix

Windows holds a file lock on any running .exe, causing uv pip install -e .
to fail with 'Access is denied (os error 5)' when it tries to overwrite
the active hermes.exe in venv/Scripts/.

Add _rename_active_windows_exe() which renames hermes.exe to hermes.exe.old
before the install step. Windows allows renaming an open executable in place,
releasing the write lock so the installer can write a fresh hermes.exe.
Add _cleanup_windows_exe_old() which removes the .old file in a finally
block after the install completes (success or failure).

No-op on non-Windows platforms.

Fixes NousResearch#23327
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels May 10, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely superseded by #23394 (merged) which fixes the same hermes.exe rename-before-install issue along with two other Windows blockers.

@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by #23394.

Triage notes (high confidence):
hermes_cli/main.py already has a more robust mechanism using timestamped quarantine 'hermes.exe.old.' with retry/MoveFileExW fallback (see line 7738 docstring and _cleanup_quarantined_exes); PR #23394 / #26677 merged.

Thanks for the contribution — the underlying problem this PR addresses has been resolved by the linked PR on current main. If you believe this was closed in error, please comment and we'll reopen.

(Bulk-closed during a CLI PR triage sweep.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: hermes update fails on Windows with Access is denied (os error 5) during uv pip install.

3 participants