actions / actions/cache

Unexpected cache miss

Open
#1,574 2 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the workflow's actions/cache@v4 step and compare its logs with the Actions → Management → Caches entry for the repeated key. Reproduce the second feature-branch push, then determine why the identical key is reported as a miss; done means the cache hit behavior is explained and the required configuration or confirmed defect is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.