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
Cache Not Matching: One or more cache(s) with similar key but they have different version or scope #1376
Describe the bug
When using the @actions/cache package, I am unable to restore caches created using the exact same running on subsequent runs.
##[debug]No matching cache found for cache key 'javascript-Linux-X64-asdf-cache-v3-ad0714eded685c1468e724c55d2e35a406f19927fb887e51f50439fb6ce03afb', version '8f2c4c9871d15fb24bd9c7ff48a327b81a4ae937f38daeb3e64228538586e821 and scope refs/heads/main. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://github.com/proxy/docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
##[debug]Other caches with similar key:
##[debug]Cache Key: javascript-Linux-X64-asdf-cache-v3-ad0714eded685c1468e724c55d2e35a406f19927fb887e51f50439fb6ce03afb, Cache Version: 70108c5493886eef63e4ea83249a420f4e651fe696[22](https://github.com/rplankenhorn/github-actions-cache-issue/actions/runs/4451018370/jobs/7817280641#step:3:23)5cdb3e6597dca83b6a5d, Cache Scope: refs/heads/main, Cache Created: 20[23](https://github.com/rplankenhorn/github-actions-cache-issue/actions/runs/4451018370/jobs/7817280641#step:3:24)-03-17T19:47:06.9966667Z
##[debug]Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
There seems to be some issue with the getCacheVersion function. From what I can tell, it seems to be giving different results when creating and restoring cache.
##[debug]Resource Url: https://github.com/proxy/artifactcache.actions.githubusercontent.com/MceA4re36QTIzQw93oLEwLlynmegnm6Wy6zMkqz54Pugm4WIPJ/_apis/artifactcache/cache?keys=javascript-Linux-X64-asdf-cache-ad0714eded685c1468e724c55d2e35a406f19927fb887e51f50439fb6ce03afb&version=70108c5493886eef63e4ea83249a420f4e651fe696225cdb3e6597dca83b6a5d
Cloning into '/home/runner/.asdf'...
##[debug]Resource Url: https://github.com/proxy/artifactcache.actions.githubusercontent.com/MceA4re36QTIzQw93oLEwLlynmegnm6Wy6zMkqz54Pugm4WIPJ/_apis/artifactcache/caches?key=javascript-Linux-X64-asdf-cache-ad0714eded685c1468e724c55d2e35a406f[19](https://github.com/rplankenhorn/github-actions-cache-issue/actions/runs/4480149929/jobs/7875080489#step:3:20)927fb887e51f50439fb6ce03afb
##[debug]No matching cache found for cache key 'javascript-Linux-X64-asdf-cache-ad0714eded685c1468e724c55d2e35a406f19927fb887e51f50439fb6ce03afb', version '70108c5493886eef63e4ea83249a4[20](https://github.com/rplankenhorn/github-actions-cache-issue/actions/runs/4480149929/jobs/7875080489#step:3:21)f4e651fe696225cdb3e6597dca83b6a5d and scope refs/heads/main. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://github.com/proxy/docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
##[debug]Other caches with similar key:
##[debug]Cache Key: javascript-Linux-X64-asdf-cache-ad0714eded685c1468e724c55d2e35a406f19927fb887e51f50439fb6ce03afb, Cache Version: 2e300497d0ee7c7058a03dff2243903148a762c27b17b76a2d7d5c1782ee4e98, Cache Scope: refs/heads/main, Cache Created: 2023-03-[21](https://github.com/rplankenhorn/github-actions-cache-issue/actions/runs/4480149929/jobs/7875080489#step:3:22)T14:21:29.39Z
##[debug]Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
@MSP-Greg I was able to resolve the above error and now cache is restoring properly. So passing in a shallow copy of the array rather than the array itself is what fixed the issue? Should the restore/save functions be updated to automatically handle this for the user?
Activity
rplankenhorn commentedon Mar 20, 2023
When running:
Result:
There seems to be some issue with the getCacheVersion function. From what I can tell, it seems to be giving different results when creating and restoring cache.
Creating getCacheVersion: 70108c5493886eef63e4ea83249a420f4e651fe696225cdb3e6597dca83b6a5d
Restoring getCacheVersion: 8f2c4c9871d15fb24bd9c7ff48a327b81a4ae937f38daeb3e64228538586e821
MSP-Greg commentedon Mar 21, 2023
@rplankenhorn I think 'paths' need to match for a cache to be restored from a saved cache. The version is based on 'paths'.
Quick look thru your code showed one is
asdfCacheOptions.inputPaths, and the other isasdfCacheOptions.cachedPathsrplankenhorn commentedon Mar 21, 2023
@MSP-Greg Thanks for getting back to me and good catch. I made the changes here but the cache is still not matching. I completely deleted all the cache, recreated them, and then ran the job a third time to try and restore them: https://github.com/rplankenhorn/github-actions-cache-issue/actions/runs/4480149929/jobs/7875080489
As you can see, still getting the same error. Here is the link to the full job: https://github.com/rplankenhorn/github-actions-cache-issue/actions/runs/4480149929/jobs/7875080489
MSP-Greg commentedon Mar 21, 2023
Can you try changing:
to
rplankenhorn commentedon Mar 21, 2023
@MSP-Greg
Edit: Actually, this might have more to do with Git and ASDF but will continue to investigate.
Interesting. Now the cache is matching but I am getting a different error when trying to restore:
rplankenhorn commentedon Mar 21, 2023
@MSP-Greg I was able to resolve the above error and now cache is restoring properly. So passing in a shallow copy of the array rather than the array itself is what fixed the issue? Should the restore/save functions be updated to automatically handle this for the user?
MSP-Greg commentedon Mar 21, 2023
Yes. It should be an array of strings, so I think
slice()works for all cases.See PR #1378
rplankenhorn commentedon Mar 21, 2023
Duplicate of #1377
Use paths slice for restore
ci: ensure cache restores use the same key and path as the correspond…