{"record":{"id":"4e20e7c01c80b44f","repo":"sveltejs/kit","slug":"the-next-hmr-update-will-cause-the-page-to-reload","errorCode":null,"errorMessage":"The next HMR update will cause the page to reload","messagePattern":"The next HMR update will cause the page to reload","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/client/client.js","lineNumber":2541,"sourceCode":"export async function handle_error(error, event) {\n\tif (error instanceof HandledHttpError) {\n\t\treturn error.body;\n\t}\n\n\t/** @type {import('@sveltejs/kit/hooks').ClientCaughtError} */\n\tlet caught;\n\n\tif (error instanceof HttpError) {\n\t\tcaught = { kind: 'app', error: error.body };\n\t} else if (error instanceof SvelteKitError) {\n\t\tcaught = { kind: 'framework', error: { status: error.status, message: error.text } };\n\t} else {\n\t\tcaught = { kind: 'unknown', error };\n\t}\n\n\tif (DEV && caught.kind !== 'app') {\n\t\terrored = true;\n\t\tconsole.warn('The next HMR update will cause the page to reload');\n\t}\n\n\tconst fallback =\n\t\tcaught.kind === 'unknown' ? { status: 500, message: 'Internal Error' } : caught.error;\n\n\tconst input = { ...caught, event };\n\tif (DEV) add_deprecated_handle_error_properties(input, fallback);\n\n\tconst app_error = await app.hooks.handleError(input);\n\n\t// the hook returns only the properties it wants to override; anything it omits\n\t// (including by returning nothing at all) is inherited from the caught error\n\treturn { ...fallback, ...app_error };\n}\n\n/**\n * @template {Function} T\n * @param {Set<T>} callbacks","sourceCodeStart":2523,"sourceCodeEnd":2559,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/client/client.js#L2523-L2559","documentation":"In dev, when an error occurs during navigation/update that is not an app-level error handled by the app's error page (caught.kind !== 'app'), SvelteKit sets an `errored` flag and logs this warning: the next Hot Module Replacement update will force a full page reload to recover from the broken state.","triggerScenarios":"An uncaught error (e.g. thrown in a load function outside app handling, or an unknown error during client-side rendering) while running `vite dev`; any subsequent HMR file change reloads the whole page instead of hot-swapping.","commonSituations":"Developers notice the dev server doing full reloads after editing files and see this warning earlier in the console — the app got into an errored state from a runtime error during navigation.","solutions":["Fix the runtime error reported above this warning so the app renders successfully.","Reload the page manually to clear the errored state before expecting HMR to work.","Throw a typed SvelteKit error (error(...) from @sveltejs/kit) and handle it via +error.svelte so it counts as an app error."],"exampleFix":"// before: uncaught throw in load\nthrow new Error('boom');\n// after\nimport { error } from '@sveltejs/kit';\nthrow error(500, 'boom'); // handled by +error.svelte, avoids forced reload","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Throw `error(...)` from @sveltejs/kit and render +error.svelte so errors are classified as app errors, not unknown ones.","Manually reload the dev page after seeing this warning to restore normal HMR.","Avoid uncaught throws in module-level or load code during development."],"tags":["hmr","dev","error-handling","console"],"backgroundTag":"hmr-forced-reload-after-error","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}