GitHub Actions cache "tar: ... Cannot open: No such file or directory"
The cache action shells out to tar over the configured path; if that path does not exist at save time (or its parent is missing at restore time), tar fails with "Cannot open: No such file or directory".
What this error means
The cache save or restore step errors with "tar: <path>: Cannot open: No such file or directory", and no cache is written or extracted.
github-actions
tar: /home/runner/.cache/pip: Cannot open: No such file or directory
tar: Error is not recoverable: exiting nowCommon causes
Cache path not created before save
The directory the cache step is told to save never got created by an earlier step, so tar has nothing to archive.
Wrong or platform-specific path
The path is incorrect for the runner OS (different home or cache location), so it does not resolve.
How to fix it
Ensure the path exists and is correct
- Confirm the cache path is actually populated before the cache step.
- Use the tool's real cache directory for the runner OS.
- Create the directory if a step expects it to pre-exist.
- Prefer setup actions' built-in cache where available.
.github/workflows/ci.yml
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}How to prevent it
- Point cache paths at directories that exist at save time.
- Account for OS-specific cache locations.
- Prefer setup-action caching over hand-rolled paths.
Related guides
GitHub Actions "Cache not found for input keys"Understand GitHub Actions "Cache not found for input keys" from actions/cache - no entry matched the primary…
GitHub Actions setup-node cache "Some specified paths were not resolved"Fix the GitHub Actions setup-node cache warning "Some specified paths were not resolved, unable to cache depe…
GitHub Actions runner disk full "No space left on device"Fix GitHub Actions "No space left on device" - the runner filled its disk during a job, breaking writes, chec…