cache: Bug: Failed to CreateCacheEntry

Greetings.

Since today Feb 7th around 1AM CET we got a problem with the actions/cache. We can’t use actions/cache/save anymore and get the following error

Warning: Failed to save: Failed to CreateCacheEntry: Received non-retryable error: Failed request: (404) Not Found: invalid request

This is a simple cache step as described in the docs:

      - name: Cache vendor
        uses: actions/cache/save@v4
        with:
          key: ${{ env.VENDOR_CACHE_KEY }}
          path: |
            vendor/
            vendor-bin/

Current workaround: Fix the version to v4.1.2. This should solve the issue for now.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 29
  • Comments: 45 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@Link-

We identified the problem, thank you all for chiming in! The fix will be released in a day or two.

Is this a backend change? Will you let us know when the fix has been released?

This is a backend change and I’ll update this issue once we deploy the fix.

In my repository, it reports

Failed to save: Failed to CreateCacheEntry: Received non-retryable error: Failed request: (409) Conflict: cache entry with the same key, version, and scope already exists

so maybe there is another issue of new service backend.

@MikeMcC399 et al, the fix is now in production. All previously locked cache keys have been cleared. New cache entries that are created but not finalized will only be reserved for up to 24 hours.

I’m going to keep this issue open for a few days in case we have some other edge cases to handle.

@yonitou et al, the backend change is coming this week. We had to iterate on a couple of ideas and put the change in motion. In short, cache keys that are locked due to a failed upload will be cleared every 24 hours from the time they’re created (after the backend fix finishes rolling out).

In the meantime, I recommend that you maintain some level of flexibility with your cache keys. As a best practice, cache availability should not be blocking to your workflows even if we aim to provide the same level of stability and availability as workflow artifacts and packages.

We identified the problem, thank you all for chiming in! The fix will be released in a day or two.

In short, when a cache entry is created, if for whatever reason it’s not finalized that slot is locked and will not be reused in future attempts to create a cache entry with the same key. Since the cache entry was never finalized, it will also not be served.

The issue just started to appear again … It’s quite urgent to fix it @Link-

My case is a little different. I expect to get this warning because I have several parallel jobs, and the first one to complete will save the cache while the rest will receive the warning. I think this is a valid pattern.

In my opinion, this warning should be removed or at least moved to the debug level. I don’t care that there is already a cache entry, and moreover, there is nothing I can do about it.

I’m currently also facing this issue. The save action is not able to save a new cache although none are existing at that moment. It always tells me that the cache is already existing although it’s not.

@andothomas and others who are still experiencing similar issues: please open a support ticket with the GitHub team and feel free to link this comment. This way we can investigate your specific situation. Please share links to the repo and workflow runs affected, and a copy of the workflow file you’re using, this will help us investigate faster what might be happening.

For now, I’m closing this issue.

@BeyondEvil - We need to separate 2 issues here:

For that error you’re seeing please read: https://github.com/actions/cache/issues/1541#issuecomment-2666975007

As a fix, start using actions/cache v4.2.2: https://github.com/actions/cache/releases/tag/v4.2.2

It seems to be exactly the issue 😃 after changing the name of the cache key I used before (even if my cache was completely empty), the 409 errors disappeared

@Link- We are also facing the issue in this public workflow

Both when trying to update to using actions/cache/restore and actions/cache/save but also while using julia-actions/cache which seems to use a pinned version of actions/cache: https://github.com/julia-actions/cache/blob/2b1bf4d8a138668ac719ea7ca149b53ed8d8401e/action.yml#L124-L131

Our current usage of caching involves:

  • Using job matrix for several job in parallel
  • Each of them having a cache step so they check for cache-hit, and needs to save it (we used save-always in the past).

However, it seems that even using cache-hit is problematic

  • For a new cache, all workflow with have cache-hit = false
  • The first job that end will save the cache without problem
  • All the other will try to save the cache as cache-hit = false, but key already exists (because of first job that end) and warning is thrown

I would be happy to have misunderstood though…

Anyhow, I’ll be interested to really understand the new constraint to correctly adapt key and restore/save in a situation of multiple job created through Matrix. All jobs should share a cache and there should not be one for each matrix element.

Thanks a lot.

In my repository, it reports

Failed to save: Failed to CreateCacheEntry: Received non-retryable error: Failed request: (409) Conflict: cache entry with the same key, version, and scope already exists

so maybe there is another issue of new service backend.

@Tiphereth-A - This is not an error, cache entries are immutable. If you’re trying to create a cache entry with the same key, you will get this warning. In a future release we will be removing this annotation to reduce confusion.

I think it works again - we use v3.

Sorry for perhaps beating a dead horse, but I’m still seeing this.

On the restore action:

Run actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57
  with:
    path: node_modules
    key: Linux-npm-ba5c47a8f2df96f9edc1a4aff74c22d266a7d9330ba72ca5ea55d0931e314f5f
    restore-keys: Linux-npm-
  
    enableCrossOsArchive: false
    fail-on-cache-miss: false
    lookup-only: false


Cache not found for input keys: Linux-npm-ba5c47a8f2df96f9edc1a4aff74c22d266a7d9330ba72ca5ea55d0931e314f5f, Linux-npm-

That’s fine, but then when the save action runs:

Run actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57
  with:
    path: node_modules
    key: Linux-npm-ba5c47a8f2df96f9edc1a4aff74c22d266a7d9330ba72ca5ea55d0931e314f5f


Warning: Failed to save: Failed to CreateCacheEntry: Received non-retryable error: Failed request: (409) Conflict: cache entry with the same key, version, and scope already exists
Warning: Cache save failed.

Am I doing something wrong?

The hash (for the version of the action) corresponds to v4.2.0 (https://github.com/actions/cache/releases/tag/v4.2.0)

Thanks @MikeMcC399 for your help @cderv, I check my cache multiple times. The cache key is not there. The slot is just locked as you mentioned. This is exactly what I’m talking about

@yonitou

Do you have an ETA ?

I am a community member like you, so I can’t provide any ETA. I also doubt whether the backend fix will solve your problem. The fix is only to suppress the warning. That’s all. You may need to open a new issue for your problem.

@dime10 - let me review, thanks for sharing the run

To conclude this report. The previous implementation of actions/cache also posts an annotation when it fails to upload a cache entry if the key exists already. The new version is just a bit more verbose.

I’ll adjust the annotation text to match the former version and add some guidance.

Image

Am I misunderstanding the situation?

I think you got it right.

The warning annotation is most likely what’s causing confusion because the legacy service would have not set a warning annotation for a cache entry key collision. This is not a failure, your workflow jobs are finishing successfully.

Yes there is no failure. One of the job is doing the saving, and the other jobs try to save later on but there is this warning thrown from each one of them as they indeed can’t. This clutter the log with a lot of warning, and this indeed created confusion has it seemed to work ok.

The (409) Conflict is normal and expected behaviour.

That is good to know. This confirm my initial understanding. I will go on with my initial change.

I’ll work with the team to reverse the warning annotation addition to prevent further confusion after I verify the behaviour with the former versions.

That would really help to not have this warning thrown by default, especially if everything is going as expected. maybe annotate in workflow debug mode only ? or do not create an annotation that go up in summary ?

This created the confusion indeed, especially as I did not see anyway to avoid each following job to detect cache have been saved already, and not try to save the cache.

Thank you.

Yes. Workaround is to fix the version to v4.1.2 then it works again.