Skip to content

JSON parse error with Rust version during configure #241

@lcheylus

Description

@lcheylus

During configuration of Swatinem/rust-cache@v2 action, I have a JSON.parse error. It seems that this error is due to output of command rustc -vV to get Rust version.

Run Swatinem/rust-cache@v2
  with:
    prefix-key: v0-rust-freebsd
    cache-targets: true
    cache-all-crates: false
    save-if: true
    cache-provider: github
    cache-bin: true
    lookup-only: false
  env:
    FEATURES: unix
    STYLE_FAIL_ON_FAULT: true
SyntaxError: Unexpected token 'r', "rustc 1.86"... is not valid JSON
    at JSON.parse (<anonymous>)
    at Workspace.getPackages (/home/runner/work/_actions/Swatinem/rust-cache/v2/dist/restore/index.js:86672:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Workspace.getWorkspaceMembers (/home/runner/work/_actions/Swatinem/rust-cache/v2/dist/restore/index.js:86690:16)
    at async CacheConfig.new (/home/runner/work/_actions/Swatinem/rust-cache/v2/dist/restore/index.js:86814:38)
    at async run (/home/runner/work/_actions/Swatinem/rust-cache/v2/dist/restore/index.js:87338:24)
Cache Configuration
  Cache Provider:
      github
  Workspaces:
      /home/runner/work/rust-coreutils/rust-coreutils
  Cache Paths:
      /home/runner/.cargo/registry
      /home/runner/.cargo/git
      /home/runner/work/rust-coreutils/rust-coreutils/target
  Restore Key:
      v0-rust-freebsd-style-Linux-x64-bd9db065
  Cache Key:
      v0-rust-freebsd-style-Linux-x64-bd9db065-fbd210f4
  .. Prefix:
    - v0-rust-freebsd-style-Linux-x64
  .. Environment considered:
    - Rust Version: 1.86.0 x86_64-unknown-freebsd (05f9846f893b09a1be1fc8560e33fc3c815cfecb)
    - CARGO_INCREMENTAL
  .. Lockfiles considered:
    - /home/runner/work/rust-coreutils/rust-coreutils/.cargo/config.toml
    - /home/runner/work/rust-coreutils/rust-coreutils/Cargo.lock

... Restoring cache ...

On my FreeBSD runner (FreeBSD 14.1 VM run with vmactions/freebsd-vm action), rustc -vV output is:

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: x86_64-unknown-freebsd
release: 1.86.0
LLVM version: 19.1.7

My workflow with use of Swatinem/rust-cache@v2 action:

- name: Configure Rust cache
      uses: Swatinem/rust-cache@v2
      with:
        prefix-key: "v0-rust-freebsd"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions