Skip to content
Latchkey

sccache "failed to store" cache object in CI

sccache compiled successfully but could not write the result to its cache backend. Builds still pass, but nothing is persisted, so subsequent runs get no hits and rebuild from scratch.

What this error means

Logs show "sccache: error: failed to store" or write errors, and sccache --show-stats reports "Cache writes errors" climbing while hits stay flat across runs.

sccache
Cache hits                         0
Cache misses                     812
Cache write errors               812
Failed distributed compilations   0

Common causes

The backend denies writes

A read-only token, a bucket policy without PutObject, or a full/expired backend prevents storing results even when reads work.

The GHA cache write was skipped

On the GitHub Actions backend, writes only persist when the job succeeds and the token is valid; a missing token drops writes silently.

How to fix it

Grant write access to the backend

  1. Confirm the token/key allows writes (PutObject, SET, cache upload).
  2. Check for a full or quota-limited backend.
  3. Re-run and watch "Cache write errors" drop to zero in stats.
Terminal
sccache --show-stats | grep -Ei 'write|store'

Ensure the GHA token is present for writes

For the Actions cache backend, keep the runtime token exposed so end-of-job writes are accepted.

.github/workflows/ci.yml
env:
  SCCACHE_GHA_ENABLED: "true"

How to prevent it

  • Give the cache token write scope, not just read.
  • Watch "Cache write errors" in sccache --show-stats as a CI signal.
  • Keep the backend within quota and the GHA token valid.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →