webpack/webpack · error · Error
check() is only allowed in idle status
Error message
check() is only allowed in idle status
What it means
Runtime HMR state machine guard. module.hot.check() (the public API, also import.meta.webpackHot.check()) may only run from the 'idle' status; calling it while the runtime is already in 'check', 'prepare', 'ready', 'dispose', 'apply', or 'abort' would corrupt the update pipeline. The guard throws synchronously to enforce the documented state transition (idle -> check -> prepare -> ready/idle).
Source
Thrown at lib/hmr/HotModuleReplacement.runtime.js:379
*/
function waitForBlockingPromises(fn) {
if (blockingPromises === 0) return fn();
return /** @type {Promise<ModuleId[]>} */ (
new Promise(function (resolve) {
blockingPromisesWaiting.push(function () {
resolve(fn());
});
})
);
}
/**
* @param {boolean | ApplyOptions=} applyOnUpdate apply the update right away
* @returns {Promise<ModuleId[] | null>} updated module ids or null
*/
function hotCheck(applyOnUpdate) {
if (currentStatus !== "idle") {
throw new Error("check() is only allowed in idle status");
}
return setStatus("check")
.then($hmrDownloadManifest$)
.then(function (update) {
if (!update) {
return setStatus(applyInvalidatedModules() ? "ready" : "idle").then(
function () {
return null;
}
);
}
return setStatus("prepare").then(function () {
/** @type {ModuleId[]} */
var updatedModules = [];
currentUpdateApplyHandlers = [];
return Promise.all(View on GitHub (pinned to 318421ea8a)
Solutions
- Always await the check() promise and verify module.hot.status() === 'idle' before calling check() again.
- Gate manual checks: if (module.hot.status() === 'idle') module.hot.check();.
- Serialize updates with a queue or flag so a second check cannot start before the first settles.
Example fix
// before
setInterval(() => module.hot.check(), 1000);
// after
async function poll() {
if (module.hot && module.hot.status() === 'idle') {
await module.hot.check();
}
} Defensive patterns
Strategy: validation
Validate before calling
async function safeCheck() {
if (!module.hot || module.hot.status() !== 'idle') return null;
return module.hot.check();
} Try / catch
try {
await module.hot.check();
} catch (e) {
if (/only allowed in idle status/.test(e.message)) {
// status changed concurrently; skip this round
} else throw e;
} Prevention
- Always check module.hot.status() === 'idle' before calling check().
- Await the check() promise before initiating another check.
- Avoid timer-based polling without a status guard.
When it happens
Trigger: Calling module.hot.check() twice in quick succession; calling check() from within a hotApply callback or an accept handler that already triggered an update; polling loops that call check() on a timer without waiting for the returned promise.
Common situations: Custom HMR UI that re-checks on a button click while a previous check is in flight; polling auto-update code that does not await the check() promise; event handlers that race with the HMR status.
Related errors
- apply() is only allowed in ready status (state: " + currentS
- [HMR] Hot Module Replacement is disabled.
- [HMR] Hot Module Replacement is disabled.
- Failed to fetch update manifest ${response.statusText}
- Environment doesn't support lazy compilation (requires Event
AI-assisted analysis of webpack/webpack@318421ea8a (2026-08-03).
Data as JSON: /data/errors/2eac60b12f1e0632.json.
Report an issue: GitHub.