# Restore Cache - Error validating cache

**URL:** <https://discuss.circleci.com/t/restore-cache-error-validating-cache/34246>\
**Category:** Build Environment\
**Created:** [January 27, 2020, 8:49pm UTC](https://discuss.circleci.com/t/restore-cache-error-validating-cache/34246 "2020-01-27T20:49:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![moorecp](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/moorecp/32/24068_2.png) [@moorecp](https://discuss.circleci.com/u/moorecp)\
**Post date:** [January 27, 2020, 8:49pm UTC](https://discuss.circleci.com/t/restore-cache-error-validating-cache/34246/1 "2020-01-27T20:49:40Z")

</div>

I have a project that saves and restores 2 caches. 1 of them works as expected while the other reports:

Error validating cache: Error listing tarball /tmp/cache632340460: exit status 2

Both caches are located within $HOME and I’m not really sure why one would work while the other would fail. What information would be useful in figuring this out? My project uses a machine executor rather than docker, for what it’s worth, and the data being cached/restored for both caches are coming from/going to directories mounted as volumes in docker.

---

<div class="post-metadata">

**Author:** ![angelisa](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/angelisa/32/22776_2.png) [@angelisa](https://discuss.circleci.com/u/angelisa)\
**Post date:** [January 31, 2020, 4:51pm UTC](https://discuss.circleci.com/t/restore-cache-error-validating-cache/34246/2 "2020-01-31T16:51:43Z")

</div>

Hi @moorecp, welcome to the CircleCI Discuss community! Without looking at your build, here are a few things I can think of:

Usually, the `save_cache` function skips when the same cache-key already stored. If your workflow is using parallelism, It’s better to separate the cache step to another job to avoid this.

If you are using docker-compose with the machine executor, the vendor folder has root permissions. Since the user of machine executor is a CircleCI user, could you try changing it to the root owner and see if you continue to experience this error?

---

<div class="post-metadata">

**Author:** ![tomotochi](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/tomotochi/32/26028_2.png) [@tomotochi](https://discuss.circleci.com/u/tomotochi)\
**Post date:** [November 27, 2020, 5:59am UTC](https://discuss.circleci.com/t/restore-cache-error-validating-cache/34246/3 "2020-11-27T05:59:46Z")

</div>

I’m experiencing the same issue. Below is the example to reproduce, in which I used docker-compose to build serverless image.

```
jobs:
  deploy:
    machine:
      docker_layer_caching: true
      user: root
    steps:
      - checkout
      - run: docker-compose build
      - restore_cache:
          keys:
            - serverless-python-requirements-v1-{{ checksum "requirements.txt" }}
      - run: |
          docker-compose run --rm \
            -e STAGE=${STAGE} \
            serverless bash -c "yarn --frozen-lockfile && yarn sls deploy --stage ${STAGE}"
      - save_cache:
          paths:
            - .serverless-python-requirements-cache
          key: serverless-python-requirements-v1-{{ checksum "requirements.txt" }}

```

CI run gives the following error:

```
Restoring Cache
Found a cache at serverless-python-requirements-v3-xxx
Size: 335 B
Cached paths:
  * /home/circleci/project/.serverless-python-requirements-cache

Downloading cache archive...
Validating cache...
Found a cache at serverless-python-requirements-v3-xxx
Size: 335 B
Cached paths:
  * /home/circleci/project/.serverless-python-requirements-cache

Downloading cache archive...
Validating cache...
Found a cache at serverless-python-requirements-v3-xxx
Size: 335 B
Cached paths:
  * /home/circleci/project/.serverless-python-requirements-cache

Downloading cache archive...
Validating cache...

Error validating cache: Error listing tarball /tmp/cache259776929: exit status 2
```
