actions/cache@v4 "Cache restore failed: Bad gateway"
A 502 Bad gateway during cache restore is a transient cache-service error, not a configuration fault. The restore is skipped and, by default, the job continues with a cold cache.
What this error means
The cache step warns "Cache restore failed: Bad gateway" and proceeds without a restored cache.
github-actions
Warning: Cache restore failed: Cache service responded with 502 Bad gateway
Cache not found for input keys: deps-...Common causes
Transient cache-service 502
The Actions cache backend returned a momentary gateway error.
Cache service degradation
Brief upstream degradation can make restores fail intermittently.
How to fix it
Tolerate the miss and re-run if needed
- Leave fail-on-cache-miss unset so a transient miss does not fail the job.
- Re-run the job; the cache service usually recovers quickly.
- Keep restore-keys so a partial-prefix restore can still help.
.github/workflows/ci.yml
- uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-How to prevent it
- Do not set fail-on-cache-miss for best-effort caches.
- Latchkey managed runners auto-retry transient cache-service failures (including 502s), so a Bad gateway on restore typically resolves without a manual re-run.
Related guides
GitHub Actions "Failed to restore: Cache service responded with 503"Fix GitHub Actions "Warning: Failed to restore: Cache service responded with 503" - the cache backend was tem…
GitHub Actions "Cache service responded with 5xx" - Transient Cache ErrorsFix transient actions/cache "Cache service responded with 500/503" errors - backend blips that should not fai…
GitHub Actions "Failed to restore: Cache service responded with 503"Fix GitHub Actions "Warning: Failed to restore: Cache service responded with 503" (or 429) - the cache backen…