Skip to content
Latchkey

actions/cache "reserveCache failed: Cache already exists" in CI

GitHub Actions caches are immutable: once a key is saved for a scope, it cannot be overwritten. When a later job tries to save the same key, the service returns "reserveCache failed: Cache already exists" and the save is skipped. The existing entry is still restorable.

What this error means

The post step warns "Failed to save: reserveCache failed: Cache already exists. Scope: refs/heads/main, Key: X, Version: ...". The build itself passes.

actions/cache
Failed to save: reserveCache failed: Cache already exists. Scope: refs/heads/main, Key: build-Linux-9f8e7d, Version: 6c1a...

Common causes

The key was already saved earlier in the run or branch

A previous job or run stored that exact key and version. Because caches are immutable, the second save cannot replace it and is rejected.

You expect a static key to update on each run

A fixed key (no hash, no run id) saves once and then always reports "already exists" on later saves while content drifts.

How to fix it

Rotate the key when content should change

Include a content hash so a new key is reserved whenever inputs change, instead of trying to overwrite a static key.

.github/workflows/ci.yml
key: build-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', 'src/**') }}
restore-keys: |
  build-${{ runner.os }}-

Ignore the warning for a deliberately stable cache

If the key is meant to be written once and reused, "Cache already exists" is expected on later runs and needs no action - the first save is what restores.

How to prevent it

  • Treat cache keys as immutable; encode content in the key to version it.
  • Use restore-keys for fallback rather than overwriting a fixed key.
  • Expect "already exists" on repeat saves of an intentionally static key.

Frequently asked questions

What causes ""reserveCache failed: Cache already exists""?
A previous job or run stored that exact key and version. Because caches are immutable, the second save cannot replace it and is rejected.
How do I fix "reserveCache failed: Cache already exists"?
Include a content hash so a new key is reserved whenever inputs change, instead of trying to overwrite a static key.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card