cache icon indicating copy to clipboard operation
cache copied to clipboard

Unexpected cache miss

Open michaelcaterisano opened this issue 9 months ago • 2 comments

I'm seeing unexpected cache misses when pushing commits to a feature branch. I have the cache action set up like this:

- name: Fetch cache
        uses: actions/cache@v4
        with:
          key: md-deps-cache-${{ hashFiles('mix.lock', '.tool-versions') }}
          path: |
            _build
            deps

When I trigger the workflow by pushing a commit to my feature branch, I see that a cache entry is created with the key md-deps-cache-9e2b2c8317020aef62614eb08fbfe828891380c4accb7ce17f872ae7c8716009

When pushing a subsequent commit, the workflow reports a cache miss, but the cache key is the same as the one created in the previous step: Cache not found for input keys: md-deps-cache-9e2b2c8317020aef62614eb08fbfe828891380c4accb7ce17f872ae7c8716009

This should be a cache hit, but it's not. Oddly, in the Actions -> Management -> Caches, I see "Last Used: 1m ago", which lines up with my second commit push. So it's as if the caches tab thinks the cache has been used, but my workflow reports a cache miss.

michaelcaterisano avatar Mar 16 '25 13:03 michaelcaterisano

I am encountering the same issue. I cannot understand why this is not working.

OscarVanL avatar Apr 03 '25 10:04 OscarVanL

similar here - in my case it happens within a single workflow, where for on of the jobs it reports a cache hit and in the other a cache miss for exactly the same cache key

pmalon avatar Apr 22 '25 10:04 pmalon