actions / actions/cache

actions/cache/save does not fail the step on error

Open
#1,581 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

actions/cache/save recently (2025-03-26) failed with a timeout and a subsequent error as it looks like the key has been created in the initial attempt:

Attempt 1 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.CacheService/CreateCacheEntry. Retrying request in 3000 ms...
Failed to save: Unable to reserve cache with key Linux-build-workspace-930, another job may be creating this cache.
Warning: Cache save failed.

The action is configured as follows:

    - name: Cache workspace
      uses: actions/cache/save@v4
      env:
        cache-name: persist-workspace
      with:
        path: |
          ...
        key: ${{ runner.os }}-build-workspace-${{ github.run_number }}

Current behavior: the step's conclusion is success:

        {
          "name": "Persist build workspace",
          "status": "completed",
          "conclusion": "success",
          "number": 19,
          "started_at": "2025-03-26T02:17:23Z",
          "completed_at": "2025-03-26T02:17:40Z"
        }

Expected behavior: the action (and job) fails if the cache cannot be created. If this is not generally wanted, having a parameter to fail the step/job on cache creation would be highly welcomed.

Please note: this is a sporadic error which we cannot reproduce. We have not noticed such a behavior before the Deprecation Notice - Upgrade to latest before February 1st 2025.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the actions/cache/save@v4 entry point and trace how CreateCacheEntry timeouts and reserve-cache errors are handled, using the reported failure output as the case to investigate. Verify that an unsuccessful cache creation produces a failed step, or that an explicit opt-in controls this behavior, and cover the observed failure path with a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.