[GH-ISSUE #285] actions/cache@v2 error: Cache Service Url not found, unable to restore cache #200

Closed
opened 2026-03-01 21:41:09 +03:00 by kerem · 15 comments
Owner

Originally created by @grische on GitHub (Jun 20, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/285

I am not sure how the cache is meant to work with nektos/act, but when working around bug #257, the cache will always throw a cache-hit=false with the following errors:

☁  git clone 'https://github.com/actions/cache' # ref=v2
🐳  docker cp src=/home/grische/.cache/act/actions-cache@v2 dst=/actions/
❓   ::save-state name=CACHE_KEY::Linux-2b7ee04efeb2a8c4ea27558750b1c2dee27f1692a30af56727638c98655a2410
💬  ::debug::Resolved Keys:
💬  ::debug::["Linux-2b7ee04efeb2a8c4ea27558750b1c2dee27f1692a30af56727638c98655a2410"]
💬  ::debug::Checking zstd --version
💬  ::debug::*** zstd command line interface 64-bits v1.3.3, by Yann Collet ***
💬  ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache.
💬  ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache.
| [warning]getCacheEntry failed: Cache Service Url not found, unable to restore cache.
⚙  ::set-output:: cache-hit=false
Originally created by @grische on GitHub (Jun 20, 2020). Original GitHub issue: https://github.com/nektos/act/issues/285 I am not sure how the cache is meant to work with nektos/act, but when working around bug #257, the cache will always throw a `cache-hit=false` with the following errors: ``` ☁ git clone 'https://github.com/actions/cache' # ref=v2 🐳 docker cp src=/home/grische/.cache/act/actions-cache@v2 dst=/actions/ ❓ ::save-state name=CACHE_KEY::Linux-2b7ee04efeb2a8c4ea27558750b1c2dee27f1692a30af56727638c98655a2410 💬 ::debug::Resolved Keys: 💬 ::debug::["Linux-2b7ee04efeb2a8c4ea27558750b1c2dee27f1692a30af56727638c98655a2410"] 💬 ::debug::Checking zstd --version 💬 ::debug::*** zstd command line interface 64-bits v1.3.3, by Yann Collet *** 💬 ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache. 💬 ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache. | [warning]getCacheEntry failed: Cache Service Url not found, unable to restore cache. ⚙ ::set-output:: cache-hit=false ```
kerem 2026-03-01 21:41:09 +03:00
Author
Owner

@benwinding commented on GitHub (Jul 22, 2020):

Happens with actions/cache@v1 too.

Seems that every test of a github action requires all npm modules to be installed....

Has anyone found a work around?

<!-- gh-comment-id:662227152 --> @benwinding commented on GitHub (Jul 22, 2020): Happens with `actions/cache@v1` too. Seems that every test of a github action requires **_all_** npm modules to be installed.... Has anyone found a work around?
Author
Owner

@rafilkmp3 commented on GitHub (Jul 29, 2020):

still searching anithin better than comment lines to use act

<!-- gh-comment-id:665386155 --> @rafilkmp3 commented on GitHub (Jul 29, 2020): still searching anithin better than comment lines to use act
Author
Owner

@quisse commented on GitHub (Jul 31, 2020):

The ACTIONS_CACHE_URL is missing.

<!-- gh-comment-id:667175560 --> @quisse commented on GitHub (Jul 31, 2020): The `ACTIONS_CACHE_URL` is missing.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 30, 2020):

Issue is stale and will be closed in 7 days unless there is new activity

<!-- gh-comment-id:701064299 --> @github-actions[bot] commented on GitHub (Sep 30, 2020): Issue is stale and will be closed in 7 days unless there is new activity
Author
Owner

@benwinding commented on GitHub (Sep 30, 2020):

Any progress on this? seems to be linked to #329

<!-- gh-comment-id:701117340 --> @benwinding commented on GitHub (Sep 30, 2020): Any progress on this? seems to be linked to #329
Author
Owner

@github-actions[bot] commented on GitHub (Jan 8, 2021):

Issue is stale and will be closed in 7 days unless there is new activity

<!-- gh-comment-id:756474901 --> @github-actions[bot] commented on GitHub (Jan 8, 2021): Issue is stale and will be closed in 7 days unless there is new activity
Author
Owner

@grische commented on GitHub (Jan 18, 2021):

I guess this can be tracked as part of #329

<!-- gh-comment-id:762221825 --> @grische commented on GitHub (Jan 18, 2021): I guess this can be tracked as part of #329
Author
Owner

@BevanR commented on GitHub (Dec 7, 2021):

Google search suggestions and results suggest that this is a popular topic and issue;

image

image

<!-- gh-comment-id:987547511 --> @BevanR commented on GitHub (Dec 7, 2021): Google search suggestions and results suggest that this is a popular topic and issue; ![image](https://user-images.githubusercontent.com/325176/144964022-2589061f-d5bb-4c2c-a13e-9a257cef909c.png) ![image](https://user-images.githubusercontent.com/325176/144964070-875c26e4-8627-4c14-850b-5b618bf4078b.png)
Author
Owner

@BevanR commented on GitHub (Dec 7, 2021):

If you are using nektos/act to develop GHA workflows locally and want to get actions/cache working so that you can get faster feedback when you test-run on your changes to GHA workflow yaml files;

  1. #329 is a dead end. Do not bother reading the long thread.
    • It is mostly about artifact upload/download actions, not cache actions.
  2. Disable cache actions with if: ${{ !env.ACT }}
  3. Use act's --reuse flag.

I will repeat that last step, because it is a much better solution than trying to get the cache action working locally;

Use act's --reuse flag

From the docs; -r, --reuse reuse action containers to maintain state

Cache saving and restoring becomes unnecessary.

<!-- gh-comment-id:987550101 --> @BevanR commented on GitHub (Dec 7, 2021): If you are using nektos/act to develop GHA workflows locally and want to get `actions/cache` working so that you can get faster feedback when you test-run on your changes to GHA workflow yaml files; 1. #329 is a dead end. Do not bother reading the long thread. - It is mostly about artifact upload/download actions, not cache actions. 2. Disable cache actions with `if: ${{ !env.ACT }}` 3. Use act's `--reuse` flag. I will repeat that last step, because it is a much better solution than trying to get the cache action working locally; # Use act's `--reuse` flag From [the docs](https://github.com/nektos/act#flags); ` -r, --reuse reuse action containers to maintain state` **Cache saving and restoring becomes unnecessary.**
Author
Owner

@netaskd commented on GitHub (Dec 19, 2021):

@BevanR in this case we have to set name: field the same for each jobs, that uses actions/cache. Otherwise it does not work...

<!-- gh-comment-id:997417178 --> @netaskd commented on GitHub (Dec 19, 2021): @BevanR in this case we have to set `name:` field the same for each jobs, that uses `actions/cache`. Otherwise it does not work...
Author
Owner

@guice commented on GitHub (Jan 4, 2022):

  1. Use act's --reuse flag.

I will repeat that last step, because it is a much better solution than trying to get the cache action working locally;

As @netaskd as informed us, this only works if each job has the same jobs.{id}.name: value, which, as you may expect, not ideal. It would be nice if --reuse reused the container for the whole workflow.

It seems --reuse keys on jobs.{id}.name for reuse.

<!-- gh-comment-id:1005193137 --> @guice commented on GitHub (Jan 4, 2022): > 3. Use act's --reuse flag. > > I will repeat that last step, because it is a much better solution than trying to get the cache action working locally; As @netaskd as informed us, this only works if each job has the same `jobs.{id}.name:` value, which, as you may expect, not ideal. It would be nice if `--reuse` reused the container for the whole workflow. It seems `--reuse` keys on `jobs.{id}.name` for reuse.
Author
Owner

@leumasme commented on GitHub (Jul 5, 2022):

I am using a github action developed by someone else in my own action via uses. Their action includes actions/cache, causing act to fail. I do not need the cache for speeding up actions, is there a way to simply ignore the cache action in subactions to get act to work without having to modify the subactions?

<!-- gh-comment-id:1175096908 --> @leumasme commented on GitHub (Jul 5, 2022): I am using a github action developed by someone else in my own action via `uses`. Their action includes `actions/cache`, causing act to fail. I do not need the cache for speeding up actions, is there a way to simply ignore the cache action in subactions to get `act` to work without having to modify the subactions?
Author
Owner

@BevanR commented on GitHub (Jul 5, 2022):

@leumasme --reuse may work in this scenario; You will still need to modify the sub-actions, but only temporarily to get it to install the cached dependencies once. Then, if the sub-action uses the cache correctly with an appropriate key, then it won't attempt to access the cache and will succeed.

<!-- gh-comment-id:1175577417 --> @BevanR commented on GitHub (Jul 5, 2022): @leumasme `--reuse` may work in this scenario; You will still need to modify the sub-actions, but only temporarily to get it to install the cached dependencies once. Then, if the sub-action uses the cache correctly with an appropriate `key`, then it won't attempt to access the cache and will succeed.
Author
Owner

@zhz125 commented on GitHub (Jul 8, 2022):

I am using bazelisk. I used the exact yml (minus mount cache step) as provided by the website and I got the following errors. Any workaround or future support for bazel?

[Unit tests/test]   💬  ::debug::*** zstd command line interface 64-bits v1.4.4, by Yann Collet ***
[Unit tests/test]   💬  ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache.
[Unit tests/test]   💬  ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache.
[Unit tests/test]   ❗  ::error::getCacheEntry failed: Cache Service Url not found, unable to restore cache.
[Unit tests/test]   ❌  Failure - Main bazelbuild/setup-bazelisk@v2
[Unit tests/test] exitcode '1': failure
<!-- gh-comment-id:1179400786 --> @zhz125 commented on GitHub (Jul 8, 2022): I am using [bazelisk](https://github.com/marketplace/actions/setup-bazelisk). I used the exact yml (minus mount cache step) as provided by the website and I got the following errors. Any workaround or future support for bazel? ``` [Unit tests/test] 💬 ::debug::*** zstd command line interface 64-bits v1.4.4, by Yann Collet *** [Unit tests/test] 💬 ::debug::getCacheEntry - Attempt 1 of 2 failed with error: Cache Service Url not found, unable to restore cache. [Unit tests/test] 💬 ::debug::getCacheEntry - Attempt 2 of 2 failed with error: Cache Service Url not found, unable to restore cache. [Unit tests/test] ❗ ::error::getCacheEntry failed: Cache Service Url not found, unable to restore cache. [Unit tests/test] ❌ Failure - Main bazelbuild/setup-bazelisk@v2 [Unit tests/test] exitcode '1': failure ```
Author
Owner

@adrianruizmora commented on GitHub (Feb 1, 2023):

If you are using nektos/act to develop GHA workflows locally and want to get actions/cache working so that you can get faster feedback when you test-run on your changes to GHA workflow yaml files;

1. [ACTIONS_RUNTIME_URL, ACTIONS_RUNTIME_TOKEN and ACTIONS_CACHE_URL environment variables are missing. #329](https://github.com/nektos/act/issues/329) is a dead end. Do not bother reading the long thread.
   
   * It is mostly about artifact upload/download actions, not cache actions.

2. Disable cache actions with `if: ${{ !env.ACT }}`

3. Use act's `--reuse` flag.

I will repeat that last step, because it is a much better solution than trying to get the cache action working locally;

Use act's --reuse flag

From the docs; -r, --reuse reuse action containers to maintain state

Cache saving and restoring becomes unnecessary.

As netaskd and guice have said you need to use the same name for each job that uses actions/cache. What i have done to make it more dynamic is to set the name of jobs like the following so i don't have to make changes to test locally or before pushing:

build:
    name: ${{ env.ACT || 'build' }} 
    ...
deploy:
    name: ${{ env.ACT || 'deploy' }} 
    ...
<!-- gh-comment-id:1411874473 --> @adrianruizmora commented on GitHub (Feb 1, 2023): > If you are using nektos/act to develop GHA workflows locally and want to get `actions/cache` working so that you can get faster feedback when you test-run on your changes to GHA workflow yaml files; > > 1. [ACTIONS_RUNTIME_URL, ACTIONS_RUNTIME_TOKEN and ACTIONS_CACHE_URL environment variables are missing. #329](https://github.com/nektos/act/issues/329) is a dead end. Do not bother reading the long thread. > > * It is mostly about artifact upload/download actions, not cache actions. > > 2. Disable cache actions with `if: ${{ !env.ACT }}` > > 3. Use act's `--reuse` flag. > > > I will repeat that last step, because it is a much better solution than trying to get the cache action working locally; > # Use act's `--reuse` flag > > From [the docs](https://github.com/nektos/act#flags); ` -r, --reuse reuse action containers to maintain state` > > **Cache saving and restoring becomes unnecessary.** As [netaskd](https://github.com/netaskd) and [guice](https://github.com/guice) have said you need to use the same name for each job that uses actions/cache. What i have done to make it more dynamic is to set the name of jobs like the following so i don't have to make changes to test locally or before pushing: ``` build: name: ${{ env.ACT || 'build' }} ... deploy: name: ${{ env.ACT || 'deploy' }} ... ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#200
No description provided.