cache icon indicating copy to clipboard operation
cache copied to clipboard

Misleading error message when attempting to overwrite the existing cache

Open Yuri05 opened this issue 2 months ago • 0 comments

The caching step in my GHA workflow is defined as follows:

    - name: Restore setup cache
      id: cache-setup
      uses: actions/cache@v4
      with:
        key: SingleAction-ospsuite-${{ env.TOOLS_CSV_HASH }}
        path: |
          ${{ env.R_LIBS_USER }}

For some reason, the action cannot find an existing cache, but that's a different issue that I'm investigating.

As the cache could not be found, the action attempts to save it again in the Post-restore setup cache step, which results in the error message. Failed to save: Unable to reserve cache with key SingleAction-ospsuite-f063a3bc68c3b4305b4e8672a9616eeab746134e3af41c4a95b6f14b6bd85cf6, another job may be creating this cache.

I struggled with this error message for a while — there were no parallel jobs that could lock the cache or anything like that. After enabling action debugging, the last debug message before this error appeared was: ##[debug]Failed to reserve cache: Error: Failed to CreateCacheEntry: Received non-retryable error: Failed request: (409) Conflict: cache entry with the same key, version, and scope already exists

This makes perfect sense and should be displayed as an error message.

Yuri05 avatar Oct 15 '25 12:10 Yuri05