ChunkLoadError: Loading chunk 4512 failed. (missing: https://example.com/_next/static/chunks/4512-a1b2c3d4.js)

Next.js · updated 2026-11-04

Thrown in the browser by the webpack runtime when a lazily loaded chunk fails to load: "missing" means the request completed but the file wasn't there (a 404 after a deploy), "timeout" and "error" mean the request itself failed. It surfaces in the browser console and in client-side error tracking, not in server logs.

ChunkLoadError: Loading chunk 4512 failed.
(missing: https://example.com/_next/static/chunks/4512-a1b2c3d4.js)
    at __webpack_require__.f.j (https://example.com/_next/static/chunks/webpack-8f2c.js:1:3912)
    at https://example.com/_next/static/chunks/webpack-8f2c.js:1:1311

Quick fix

If it follows deploys and says missing, the old HTML is asking for chunk files the new build replaced. Set a deploymentId per deployment so Next.js reloads the page when the deployment changes, keep the previous build's /_next/static files available for a while, and as a fallback reload once when a ChunkLoadError is caught. If it says timeout or error, look at the network: blocked requests, a CDN problem or flaky mobile connections.

  1. Look at the part in parentheses: missing (file gone, usually a deploy) vs timeout or error (network).
  2. Set deploymentId (or NEXT_DEPLOYMENT_ID) to a per-deploy value so mismatched clients do a full reload.
  3. Keep old /_next/static files for at least a few hours after a deploy (most CDNs and object storage can keep them).
  4. Don't cache HTML pages long at the CDN: cached HTML points at chunk files that no longer exist.
  5. Fallback: catch ChunkLoadError in an error boundary or window error handler and reload the page once.
typescript
// app/error.tsx (route error boundary): reload once on a stale chunk
'use client';

export default function ErrorBoundary({ error }: { error: Error & { digest?: string } }) {
  if (typeof window !== 'undefined' && error.name === 'ChunkLoadError' && !sessionStorage.getItem('chunk-reload')) {
    sessionStorage.setItem('chunk-reload', '1');
    window.location.reload();
    return null;
  }
  return <p>Something went wrong. Please reload the page.</p>;
}

Why it happens

Deploy replaced the old chunks

A tab opened before the deploy navigates to a page whose code was split into a chunk with an old hashed name that the new server no longer has.

HTML cached longer than assets

A CDN keeps serving cached HTML from the old build while the old chunk files are gone.

Network or blocking

timeout or error instead of missing: slow mobile connections, corporate proxies, browser extensions or a CDN outage blocked the request.

Wrong asset prefix

assetPrefix or basePath set differently from where the files are served makes every lazy chunk 404, not just after deploys.

Other fixes

  • CSS chunks fail the same way with "Loading CSS chunk … failed".
  • Report these with the deployment ID attached so you can tell skew from real breakage in your error tracker.

Same error, other wording

  • ChunkLoadError: Loading chunk 123 failed. (timeout: https://example.com/_next/static/chunks/123.js)
  • Loading CSS chunk 456 failed.
  • ChunkLoadError: Loading hot update chunk app/layout failed.

Let your coding agent catch the next one

This error happens in the browser, and Runheed doesn't capture browser errors yet: there is no browser SDK. What it does record is the server side of your app (route handlers, server rendering, API errors and background jobs) with the stack trace and the breadcrumbs before it, and serves those errors to Claude Code, Cursor or any MCP client.

Plans from $29/moSee what your agent readsSee the setupCancel any time from the billing portal

Related errors

More in React and Next.js rendering

References: Next.js docs: deploymentId (version skew), webpack source: the ChunkLoadError message