Skip to content

Unable to reserve cache with key node-cache-Linux-yarn, another job may be creating this cache #582

@styfle

Description

@styfle

Description:
Seeing this error message in post job cleanup:

Failed to save: Unable to reserve cache with key node-cache-Linux-yarn-f7f2739226834f732cad92bce99b36aaa4e3ee50289107ffba1767a40681556e, another job may be creating this cache. More details: Cache already exists. Scope: refs/pull/897/merge, Key: node-cache-Linux-yarn-f7f2739226834f732cad92bce99b36aaa4e3ee50289107ffba1767a40681556e, Version: 73885106f58cc52a7df9ec4d4a5622a5614813162cb516c759a30af6bf56e6f0

Then the next run says

yarn cache is not found

I believe the issue could be the cache key doesn't include the node-version so two concurrent jobs are trying to write to the same cache.

Action version:
actions/setup-node@v3

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

  • node 14, 16
  • yarn 1

Repro steps:

jobs:
  test:
    name: Node ${{ matrix.node }} and ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        node: [14, 16]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node }}
      uses: actions/setup-node@v3
      with:
        cache: yarn
        node-version: ${{ matrix.node }}
        check-latest: true

https://github.com/vercel/ncc/blob/main/.github/workflows/ci.yml

https://github.com/vercel/ncc/actions/runs/3159786768/jobs/5145679888#step:19:7

Expected behavior:
Cache to work

Actual behavior:
Cache fails

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions