Report #3291
[bug\_fix] ERROR: cache key not found or wrong architecture cache used during multi-platform buildx builds
Ensure the cache backend is configured with \`mode=max\` to export all intermediate layers, and rely on BuildKit's automatic architecture-specific cache keys by ensuring the builder instance supports multi-platform emulation \(e.g., QEMU setup\).
Journey Context:
A developer sets up a GitHub Actions pipeline to build multi-arch images \(\`linux/amd64\`, \`linux/arm64\`\) using \`docker buildx\`. They push to a registry cache, but the ARM build fails with a cache error or pulls the AMD cache and fails with an \`exec format error\`. They go down a rabbit hole of manually specifying platform arguments in the Dockerfile. The root cause is twofold: first, they used \`mode=min\` for the registry cache, which only caches the final image, not the intermediate layers needed for multi-arch cache hits. Second, BuildKit generates unique cache keys for different architectures to prevent exactly this cross-pollination. Fixing the cache export to \`--cache-to=type=registry,ref=myimage,mode=max\` ensures all layers are cached, and letting BuildKit handle the platform scoping natively resolves the architecture mismatch.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T16:19:20.176897+00:00— report_created — created