Skip to content

[BUG] Updating cargo-binstall through UniGetUI can never succeed on Windows (binary replaces itself) #5371

Description

@PowerUserZ

Please confirm these before moving forward

  • I have searched for my issue and have not found a work-in-progress/duplicate/resolved issue.
  • I have tested that this issue has not been fixed in the latest (beta or stable) release.
  • I have checked the FAQ section for solutions.
  • This issue is about a bug.

UniGetUI Version

2026.2.7 (latest stable)

Windows version, edition, and architecture

Windows 11 Pro 10.0.26200 x64

Describe your issue

Updating the cargo-binstall package itself through UniGetUI (Cargo manager) can never succeed on Windows.

When cargo-binstall is present, UniGetUI runs every Cargo update as:

cargo.exe binstall <package> --no-confirm

(CargoPkgOperationHelper._getOperationParameters, OperationType.Update branch, UpdateVerb = "binstall" in Cargo.cs).

For the package cargo-binstall this means the running cargo-binstall.exe is asked to overwrite itself. cargo-binstall handles that case only when it downloads a prebuilt binary (upstream fix cargo-bins/cargo-binstall#712 for #702). When its fetchers time out and it falls back to cargo install cargo-binstall ("will be installed from source (with cargo)"), the fallback simply shells out to cargo install, which compiles for ~3 minutes and then fails to replace the locked executable:

   Replacing C:\Users\<user>\.cargo\bin\cargo-binstall.exe
error: failed to move `C:\Users\<user>\.cargo\bin\cargo-installAeQfV8\cargo-binstall.exe` to `C:\Users\<user>\.cargo\bin\cargo-binstall.exe`

Caused by:
  Access is denied. (os error 5)
ERROR Cargo errored! ExitStatus(ExitStatus(101))

Windows does not allow a running .exe to be replaced, so this path can never work. Every attempt leaves the old version installed, UniGetUI keeps listing cargo-binstall as updatable, and each retry costs a full source build. Stale cargo-binstall.exe~RF*.TMP files are also left behind in %USERPROFILE%\.cargo\bin.

Upstream tracks self-replace for the remaining cases in cargo-bins/cargo-binstall#1066 (open since 2023), so UniGetUI should not rely on cargo binstall cargo-binstall for this package.

Suggested fix

Special-case package.Id == "cargo-binstall" in CargoPkgOperationHelper and update it without going through the running binary, e.g.:

cargo.exe install cargo-binstall --locked --force

cargo.exe is a different file, so it can replace cargo-binstall.exe without a lock conflict. This is also the exact command Cargo.cs already uses as the binstall dependency installer ("cargo install cargo-binstall --locked"), so the code path exists.

Steps to reproduce the issue

  1. Windows, cargo-binstall installed in %USERPROFILE%\.cargo\bin (as installed by UniGetUI's dependency prompt).
  2. Wait until a newer cargo-binstall release exists (here: 1.19.0 -> 1.23.0).
  3. In UniGetUI, Software Updates -> update "Cargo Binstall".
  4. Update fails with exit code 70 after the source build; the installed version is unchanged.

Reproduced on 2026-08-16 (1.21.1) and 2026-09-11 (1.23.0). Manual workaround that works: cargo install cargo-binstall --locked --force from a terminal, or the official install-from-binstall-release.ps1 script.

UniGetUI Log

Package update operation for Package=cargo-binstall with Manager=Cargo
Update options: <InstallOptions instance (only non-default values are shown)
	RunAsAdministrator: True
	OverridesNextLevelOpts: False>
Version: 1.19.0 -> 1.23.0
Executing process with StartInfo:
 - FileName: "C:\Program Files\UniGetUI\Assets\Utilities\UniGetUI Elevator.exe"
 - Arguments: ""C:\Users\<user>\.cargo\bin\cargo.exe"  binstall cargo-binstall --no-confirm"
Start Time: "11.09.2026 17:35:20"
 INFO resolve: Resolving package: 'cargo-binstall'
 WARN resolve: Timeout reached while checking fetcher invalid url: deadline has elapsed
 (repeated x9)
 WARN resolve: Timeout reached while checking fetcher QuickInstall: deadline has elapsed
 (repeated x9)
 WARN The package cargo-binstall v1.23.0 will be installed from source (with cargo)
Updating crates.io index
Downloading crates ...
Downloaded cargo-binstall v1.23.0
Installing cargo-binstall v1.23.0
Locking 544 packages to latest compatible versions
...
error: failed to compile `cargo-binstall v1.23.0`, intermediate artifacts can be found at `C:\Users\<user>\AppData\Local\Temp\cargo-installiTKvt6`.
ERROR Cargo errored! ExitStatus(ExitStatus(101))
ERROR Fatal error:
  x For crate cargo-binstall: subprocess C:\Users\<user>\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\cargo.exe install cargo-binstall --version 1.23.0 --root C:\Users\<user>\.cargo errored with exit code: 101

Operation history: Status=failed, ExitCode=70, "Cargo Binstall could not be updated".

Package Managers Logs

Same command run manually in a terminal (cargo binstall cargo-binstall) shows the underlying cause after the build finishes:

   Compiling binstalk-fetchers v0.10.48
   Compiling binstalk-registry v0.12.8
   Compiling binstalk v0.28.81
    Finished `release` profile [optimized] target(s) in 2m 53s
   Replacing C:\Users\<user>\.cargo\bin\cargo-binstall.exe
error: failed to move `C:\Users\<user>\.cargo\bin\cargo-installAeQfV8\cargo-binstall.exe` to `C:\Users\<user>\.cargo\bin\cargo-binstall.exe`

Caused by:
  Access is denied. (os error 5)
ERROR Cargo errored! ExitStatus(ExitStatus(101))
ERROR Fatal error:
  x For crate cargo-binstall: subprocess ...\cargo.exe install cargo-binstall --version 1.23.0 --root C:\Users\<user>\.cargo errored with exit code: 101

Relevant information

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions