Report #77293
[bug\_fix] Cache not found for input keys or cross-OS cache poisoning in matrix builds
Include the OS and architecture in the cache key: \`key: $\{\{ runner.os \}\}-$\{\{ runner.arch \}\}-node-$\{\{ hashFiles\('\*\*/package-lock.json'\) \}\}\`. The hashFiles function works consistently across OSes, but the cache restore must be scoped to the specific runner type to avoid restoring Linux binaries to a Windows runner or vice versa.
Journey Context:
A team configures a matrix build across ubuntu-latest, windows-latest, and macos-latest to test their Node.js application. They add actions/cache to speed up npm installs. The first run on Ubuntu populates the cache key 'node-abc123'. The Windows job then restores that same cache key, pulling Linux ELF binaries into node\_modules, then fails with 'cannot execute binary format' or mysterious module loading errors. The developer spends a day debugging the Windows environment before realizing the cache key collided across OS boundaries. Adding $\{\{ runner.os \}\} to the key ensures each platform maintains its own binary cache.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:20:16.689448+00:00— report_created — created