Skip to content

ci: macOS Native host build fails with 'cargo metadata: unexpected argument' (rust-cache) #1129

@carlos-alm

Description

@carlos-alm

Problem

The Native host build (macos-latest) job in .github/workflows/ci.yml consistently fails on the Build native addon step with:

Internal Error: cargo metadata exited with code 1 and error message:
error: error: unexpected argument 'metadata' found

This blocks merges on multiple open PRs (observed on #1128, #1119, etc.) without any code change being responsible.

Reproduction

Any push to a PR with native Rust changes triggers it. Examples:

Suspected cause

The macOS runner appears to resolve cargo to a binary that doesn't accept the metadata subcommand. Most likely culprit: the Install napi-rs CLI step installs a global napi binary, but somewhere in the path resolution a wrong cargo is picked up by Swatinem/rust-cache (which calls cargo metadata internally).

Suggested fix

Investigate PATH ordering on macOS runners; pin rust-cache and napi-rs versions; consider adding a debug step that runs which cargo && cargo --version before rust-cache.

Context

Filed during sweep of PR #1128. The PR itself has no Rust toolchain changes — the failure is environmental.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciContinuous integration / buildfollow-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