{"record":{"id":"fd7007bedf504ee4","repo":"vercel/next.js","slug":"apply-is-only-allowed-in-ready-status-state","errorCode":null,"errorMessage":"apply() is only allowed in ready status (state: \" + currentStatus + \")","messagePattern":"apply\\(\\) is only allowed in ready status \\(state: \" \\+ currentStatus \\+ \"\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/bundles/webpack/packages/HotModuleReplacement.runtime.js","lineNumber":310,"sourceCode":"\t\t\t\t\t\t}, [])\n\t\t\t\t\t).then(function () {\n\t\t\t\t\t\treturn waitForBlockingPromises(function () {\n\t\t\t\t\t\t\tif (applyOnUpdate) {\n\t\t\t\t\t\t\t\treturn internalApply(applyOnUpdate);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn setStatus(\"ready\").then(function () {\n\t\t\t\t\t\t\t\treturn updatedModules;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\tfunction hotApply(options) {\n\t\tif (currentStatus !== \"ready\") {\n\t\t\treturn Promise.resolve().then(function () {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"apply() is only allowed in ready status (state: \" +\n\t\t\t\t\t\tcurrentStatus +\n\t\t\t\t\t\t\")\"\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\t\treturn internalApply(options);\n\t}\n\n\tfunction internalApply(options) {\n\t\toptions = options || {};\n\n\t\tapplyInvalidatedModules();\n\n\t\tvar results = currentUpdateApplyHandlers.map(function (handler) {\n\t\t\treturn handler(options);\n\t\t});\n\t\tcurrentUpdateApplyHandlers = undefined;","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/bundles/webpack/packages/HotModuleReplacement.runtime.js#L292-L328","documentation":"webpack HMR runtime state machine invariant inside hotApply: module.hot.apply() was called while the HMR status was not \"ready\", meaning no finished update was awaiting application. The rejected promise includes the actual currentStatus so callers can see which state they raced.","triggerScenarios":"Calling HotModuleReplacement.apply() when the HMR runtime status is not ready.","commonSituations":"An HMR update is applied before the check/download phase finished, typically during rapid edits in next dev.","solutions":["Only call apply() when the HMR runtime status is ready; internal invariant — upgrade Next.js or report the state mismatch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}