denoland/deno · error · Error
ERR_INSPECTOR_NOT_ACTIVE
ERR_INSPECTOR_NOT_ACTIVE
Error message
Inspector is not active
What it means
inspector.waitForDebugger() suspends the current thread until an attached debugger resumes it. It is only valid while the inspector is active: the underlying op_inspector_wait() returns false when no inspector is running (neither --inspect flags nor inspector.open()), and waitForDebugger throws ERR_INSPECTOR_NOT_ACTIVE.
Source
Thrown at ext/node/polyfills/inspector.js:278
},
};
}
function close() {
op_inspector_close();
}
function url() {
const u = op_inspector_url();
if (u === null) {
return undefined;
}
return u;
}
function waitForDebugger() {
if (!op_inspector_wait()) {
throw new ERR_INSPECTOR_NOT_ACTIVE();
}
}
function broadcastToFrontend(eventName, params) {
validateString(eventName, "eventName");
if (params) {
validateObject(params, "params");
}
op_inspector_emit_protocol_event(eventName, JSONStringify(params ?? {}));
}
function broadcastNetworkData(eventName, params) {
if (params && params.data !== undefined) {
const encoded = encodeNetworkData(params.data);
if (encoded !== params.data) {
params = ObjectAssign({ __proto__: null }, params, { data: encoded });
}
}View on GitHub (pinned to 9ad36f7a2c)
Solutions
- Launch with --inspect-brk (breaks before start and enables the inspector) and keep the waitForDebugger call.
- Or activate programmatically first: inspector.open(); inspector.waitForDebugger().
- Gate the call behind a debug flag/env var so normal runs skip it.
Example fix
// before - deno run app.ts (no inspector) inspector.waitForDebugger(); // ERR_INSPECTOR_NOT_ACTIVE // after - deno run --inspect-brk app.ts inspector.waitForDebugger();
Defensive patterns
Strategy: validation
Validate before calling
import inspector from 'node:inspector';
function waitForDebuggerSafe() {
if (inspector.url() === undefined) return false; // inspector not active
inspector.waitForDebugger();
return true;
} Type guard
import inspector from 'node:inspector';
function canWaitForDebugger() {
return inspector.url() !== undefined;
} Prevention
- Gate waitForDebugger() behind a DEBUG env var or CLI flag so CI and prod never hit it.
- Keep --inspect-brk in the run command whenever the pause point is enabled.
- Check inspector.url() before any inspector-state-dependent call.
When it happens
Trigger: Calling inspector.waitForDebugger() under a plain `deno run app.ts` (no --inspect, no prior inspector.open()); calling it after inspector.close().
Common situations: A 'pause until debugger attaches' helper left enabled in CI where no inspector flag is set; ported Node debugging workflows where the launch flag was forgotten.
Related errors
- ERR_INSPECTOR_ALREADY_ACTIVATED
- Expected data to be a string, Buffer, Uint8Array, or ArrayBu
- ERR_INSPECTOR_ALREADY_CONNECTED
- ERR_INSPECTOR_NOT_WORKER
- ERR_INSPECTOR_NOT_CONNECTED
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/826a4b1e22808123.
Report an issue: GitHub.