Skip to content

ci: disable cache-bin to fix flaky macOS builds#411

Merged
rcoh merged 1 commit into
mainfrom
fix/macos-ci-cache-bin
May 15, 2026
Merged

ci: disable cache-bin to fix flaky macOS builds#411
rcoh merged 1 commit into
mainfrom
fix/macos-ci-cache-bin

Conversation

@rcoh
Copy link
Copy Markdown
Contributor

@rcoh rcoh commented May 15, 2026

Problem

The macOS CI job flakes with:

error: unexpected argument 'test' found
Usage: rustup-init[EXE] [OPTIONS]

This happens because Swatinem/rust-cache@v2 with cache-bin: true (the default) caches ~/.cargo/bin. On macOS, dtolnay/rust-toolchain sets RUSTUP_PERMIT_COPY_RENAME=1, so rustup proxy binaries (cargo, rustc, etc.) are copies of the rustup binary rather than hardlinks.

When the cache restores these stale copies after a rustup version change on the runner image, the cargo binary resolves to rustup-init instead of the proper proxy, breaking all cargo commands.

Fix

Set cache-bin: "false" so Swatinem/rust-cache no longer caches ~/.cargo/bin. Rustup manages its own proxy binaries; they should not be cached.

This is a documented known issue in rust-cache.

Impact

  • Fixes the flaky macOS CI failure
  • Negligible CI time impact: the bin directory only contains rustup proxies (tiny files), not compiled binaries
  • No change to Linux behavior (same root cause exists but is less likely to manifest since Linux uses hardlinks)

Swatinem/rust-cache with cache-bin: true (the default) caches
~/.cargo/bin, which contains rustup proxy binaries. On macOS, rustup
uses RUSTUP_PERMIT_COPY_RENAME=1, so these proxies are copies of the
rustup binary. When the cache restores stale copies, they can resolve
to rustup-init instead of the proper cargo proxy, causing:

  error: unexpected argument 'test' found
  Usage: rustup-init[EXE] [OPTIONS]

Setting cache-bin: false prevents caching the bin directory, letting
rustup manage its own proxy binaries correctly.
@rcoh rcoh requested a review from a team May 15, 2026 18:15
@rcoh rcoh enabled auto-merge May 15, 2026 18:15
@rcoh rcoh added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit d44d47b May 15, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants