{"record":{"id":"826a4b1e22808123","repo":"denoland/deno","slug":"err-inspector-not-active","errorCode":"ERR_INSPECTOR_NOT_ACTIVE","errorMessage":"Inspector is not active","messagePattern":"Inspector is not active","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ext/node/polyfills/inspector.js","lineNumber":278,"sourceCode":"    },\n  };\n}\n\nfunction close() {\n  op_inspector_close();\n}\n\nfunction url() {\n  const u = op_inspector_url();\n  if (u === null) {\n    return undefined;\n  }\n  return u;\n}\n\nfunction waitForDebugger() {\n  if (!op_inspector_wait()) {\n    throw new ERR_INSPECTOR_NOT_ACTIVE();\n  }\n}\n\nfunction broadcastToFrontend(eventName, params) {\n  validateString(eventName, \"eventName\");\n  if (params) {\n    validateObject(params, \"params\");\n  }\n  op_inspector_emit_protocol_event(eventName, JSONStringify(params ?? {}));\n}\n\nfunction broadcastNetworkData(eventName, params) {\n  if (params && params.data !== undefined) {\n    const encoded = encodeNetworkData(params.data);\n    if (encoded !== params.data) {\n      params = ObjectAssign({ __proto__: null }, params, { data: encoded });\n    }\n  }","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/inspector.js#L260-L296","documentation":"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.","triggerScenarios":"Calling inspector.waitForDebugger() under a plain `deno run app.ts` (no --inspect, no prior inspector.open()); calling it after inspector.close().","commonSituations":"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.","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."],"exampleFix":"// before - deno run app.ts (no inspector)\ninspector.waitForDebugger(); // ERR_INSPECTOR_NOT_ACTIVE\n\n// after - deno run --inspect-brk app.ts\ninspector.waitForDebugger();","handlingStrategy":"validation","validationCode":"import inspector from 'node:inspector';\nfunction waitForDebuggerSafe() {\n  if (inspector.url() === undefined) return false; // inspector not active\n  inspector.waitForDebugger();\n  return true;\n}","typeGuard":"import inspector from 'node:inspector';\nfunction canWaitForDebugger() {\n  return inspector.url() !== undefined;\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["inspector","debugging","startup","node-compat"],"backgroundTag":"inspector-not-active","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}