`Error: getCacheEntry failed: Cache service responded with 500`
setup-ocaml is failing on my new projects with
Run ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.05.x
opam-pin: true
opam-depext: true
opam-local-packages: *.opam
opam-disable-sandboxing: false
dune-cache: false
cache-prefix: v1
github-token: ***
Retrieve the opam cache
Error: getCacheEntry failed: Cache service responded with 500
hopefully it's just a temporary failure.
https://github.com/actions/cache/issues/698
Posting here for visibility. This issue should now be mitigated. https://github.com/actions/cache/issues/698#issuecomment-992069658
@dhadka I wonder if this should really be treated as error in the Action. I think you should just only warn or tell in the console about this kind of error. And it's probably not something that should be done on our side, but something that should be addressed on the actions package side.
@smorimoto Yeah, the issue currently is that the cache NPM module and the cache action behave differently with error handling. The NPM module does not handle exceptions and will throw, it's up to the caller to catch and handle them. It's the cache action that is handling and suppressing those errors - https://github.com/actions/cache/blob/bd492913657217c4685db3a9cac721bca7d62caa/src/save.ts#L55.
On one hand, by throwing errors, the NPM module lets consumers decide how to handle errors. But it's also not documented in https://github.com/actions/toolkit/tree/main/packages/cache that callers can and should catch these errors. Maybe as a way to support both cases we have the NPM module handle these errors by default but provide a throwOnError: true argument?
Fair enough. I think it's enough to just put something on the documentation.
The problem here is that errors can also occur when pulling the cache. For now, I've improved the error handling on pushing the cache in #371, but the one on pulling will be a bit more complicated. (But it's not the cache package's responsibility.)