You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@actions/cache not restoring cache, version mismatch? #1377
We use @actions/cache in a popular setup action. Recently updated the lock file which previously used 3.0.6 without issue. Caches appear to be saved, but they are not restored with restoreCache.
In the first job run, often the cache was saved. If the next run did not restore it, the run also had the common error:
'Failed to save: Unable to reserve cache with key , another job may be creating this cache. More details: Cache already exists.'
Expected behavior
Versions after 3.0.6 restore caches.
Screenshots
NA
Desktop (please complete the following information):
NA
Reacted by Patrik Ragnarsson, Opportunity, Alec Hartung, Weetbix, Elena Kazakova, Benoit Daloze, Aaron Bernard, Oleksandr Danylchenko, Anurag Hazra, John Molakvoæ and 24 more
We use @actions/cache in a popular setup action. Recently updated the lock file which previously used 3.0.6 without issue. Caches appear to be saved, but they are not restored with restoreCache.
In the first job run, often the cache was saved. If the next run did not restore it, the run also had the common error:
'Failed to save: Unable to reserve cache with key , another job may be creating this cache. More details: Cache already exists.'
This is now affecting bahmutov/npm-install and affected us through a dependabot bump of that action, and then it takes some time to notice the install time in CI has exploded. So I expect soon some more thumbs :)
Reacted by Elena Kazakova, Oleksandr Danylchenko, Anurag Hazra, Yasha Prikhodko, Daniel Reichhart, Håkon Meyer Tørnquist and Danila Danko
Activity
MSP-Greg commentedon Mar 18, 2023
Did some more work on this, and I changed the cache key so that it did not match previous keys. Making use of the 'Re-run all jobs' feature.
The first job correctly saves the cache
The cache key appears in the Web UI's list of caches
Re-running the job, the cache is not found, and when trying to save it, the following error logged:
MSP-Greg commentedon Mar 20, 2023
After using the API to get a cache list, and switching core.debug on, it seems the issue is a mismatch in the version of the cache.
From the above the cache key matches, but debug shows:
[-]@actions/cache not restoring cache[/-][+]@actions/cache not restoring cache, version mismatch?[/+]Kurt-von-Laven commentedon Apr 21, 2023
I suspect this may be working as intended on account of cache versioning.
MSP-Greg commentedon Apr 21, 2023
See #1378 (comment)
Kurt-von-Laven commentedon Apr 21, 2023
Is passing a copy of the paths a workaround for this issue then?
MSP-Greg commentedon Apr 21, 2023
Yes. Regardless, one could consider it a breaking change...
Mater2211 commentedon Apr 21, 2023
eregon commentedon Apr 24, 2023
It's quite disappointing such a clear and important issue with an attached PR is not dealt with in a month, GitHub Actions maintainers.
Kurt-von-Laven commentedon Apr 24, 2023
I don't think that's particularly fair considering this issue currently has zero upvotes.
MSP-Greg commentedon Apr 24, 2023
Another way of looking at it is whether many 'setup-*' actions were using the current version of @actions/cache.
I looked at several when I opened the PR, almost all were not.
Weetbix commentedon May 16, 2023
This is now affecting
bahmutov/npm-installand affected us through a dependabot bump of that action, and then it takes some time to notice the install time in CI has exploded. So I expect soon some more thumbs :)jphawk commentedon May 17, 2023
Same here,
bahmutov/npm-installstarted to fail withnpm cache hit undefined.oleksandr-danylchenko commentedon May 29, 2023
I'm getting the
npm cache hit undefinedusingbahmutov/npm-install. But the error at the end of the job says: "Cache already exists".pcfreak30 commentedon Jun 25, 2023
Sigh, think I just hit this issue as well...
Workaround for actions/toolkit#1377
Workaround for actions/toolkit#1377
Merge pull request #4 from sorah-rbpkg/workaround-for-actions-toolkit…
Pin cache action to v3.0.6 for actions/toolkit#1377 workaround
fix: downgrade @actions/cache actions/toolkit#1377
Trying to fix issue with restoreCache by pinning it to 3.0.6
ali-kafel commentedon Dec 19, 2023
Running into this issue as well but with github actions self hosted runners in kubernetes mode vs dind mode