Skip to content

ci: Build x86_64-apple-darwin sporadically fails — cargo resolves to rustup-init on macos-14 #1136

@carlos-alm

Description

@carlos-alm

Symptom

The Build Native workflow's Build x86_64-apple-darwin matrix job (runs on macos-14) intermittently fails during the Build native addon step with:

Internal Error: cargo metadata exited with code 1 and error message:
error: error: unexpected argument 'metadata' found
Usage: rustup-init[EXE] [OPTIONS]

This indicates the cargo binary is resolving to rustup-init rather than the real Cargo from the stable toolchain. The macos-14 runner image is now ARM-only (macos-14-arm64), so dtolnay/rust-toolchain@stable is installing the host toolchain (aarch64-apple-darwin) and adding the x86_64 target via --target x86_64-apple-darwin.

Where

.github/workflows/build-native.yml — matrix entry os: macos-14, target: x86_64-apple-darwin.

Recent occurrences

Likely fix

  • Switch os for the x86_64-apple-darwin matrix entry back to an Intel-only image (e.g. macos-13), or
  • Use a single macos-latest entry that natively matches the target arch, or
  • Disambiguate cargo on PATH after the toolchain step (e.g. echo "$CARGO_HOME/bin" >> $GITHUB_PATH explicitly before napi build).

Context

Surfaced while clearing PR #1128 to a clean CI state. The failure is unrelated to the PR's diff (it reproduces on a fresh re-run with no code changes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upDeferred work from PR reviews that needs tracking

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions