Skip to content

@remotion/bundler: Handle webpack cache corruption on low-memory machines#6886

Merged
JonnyBurger merged 2 commits intomainfrom
fix/webpack-cache-corruption
Mar 20, 2026
Merged

@remotion/bundler: Handle webpack cache corruption on low-memory machines#6886
JonnyBurger merged 2 commits intomainfrom
fix/webpack-cache-corruption

Conversation

@JonnyBurger
Copy link
Copy Markdown
Member

Summary

  • Automatically detect and recover from webpack filesystem cache corruption during bundling
  • When a cache corruption error is detected (e.g. wasm-hash TypeError), the cache is cleared and bundling is retried once
  • Previously, users had to manually delete node_modules/.cache/webpack to recover

Closes #6865

Test plan

  • Verify normal bundling still works with caching enabled
  • Verify normal bundling works with caching disabled (enableCaching: false)
  • Verify that a corrupted cache file in node_modules/.cache/webpack triggers automatic recovery

🤖 Generated with Claude Code

When webpack's filesystem cache gets corrupted (e.g. due to low memory
causing incomplete writes), bundling crashes with a TypeError in
wasm-hash. Detect cache corruption errors and automatically clear the
cache and retry once, instead of requiring manual deletion.

Closes #6865

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Mar 20, 2026 10:46am
remotion Ready Ready Preview, Comment Mar 20, 2026 10:46am

Request Review

@JonnyBurger JonnyBurger marked this pull request as ready for review March 20, 2026 10:41
@JonnyBurger JonnyBurger enabled auto-merge (squash) March 20, 2026 10:41
@JonnyBurger JonnyBurger changed the title Fix webpack cache corruption on low-memory machines @remotion/bundler: Fix webpack cache corruption on low-memory machines Mar 20, 2026
@JonnyBurger JonnyBurger changed the title @remotion/bundler: Fix webpack cache corruption on low-memory machines @remotion/bundler: Handle webpack cache corruption on low-memory machines Mar 20, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

The implementation is focused and solves the stated problem well. Two minor observations, neither blocking:

Line 319–331: The enableCaching !== false guard is correct but subtle. When enableCaching is undefined (the default when not explicitly passed), it still triggers the retry. This is the right behavior (clearing a non-existent cache is harmless), but a comment noting this would help future readers.

No test coverage for the retry path. The test plan items are unchecked and no tests were added. Specifically, a unit or integration test that simulates a cache-corruption-like error and verifies the retry behavior would give confidence that this path works without requiring manual cache corruption. This is especially important since the recovery can only be triggered by a real corrupted cache state.

No blockers: the looksLikeCacheCorruption patterns are specific enough, the clearCache call correctly targets the production cache directory, and the retry correctly re-throws on persistent failure.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow runpullfrog.com𝕏

return false;
}

const message = err.message + (err.stack ?? '');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: err.stack can be very long. Consider also passing err.cause if this error wraps another error, since the corruption signal could be in the cause rather than the direct stack.

@JonnyBurger JonnyBurger merged commit d397ced into main Mar 20, 2026
20 checks passed
@JonnyBurger JonnyBurger deleted the fix/webpack-cache-corruption branch March 20, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache Corruption on low memory machines

1 participant