{"record":{"id":"12c7ac3996b3bf7d","repo":"parcel-bundler/parcel","slug":"the-inspector-module-isn-t-available","errorCode":null,"errorMessage":"The inspector module isn't available","messagePattern":"The inspector module isn't available","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/core/profiler/src/SamplingProfiler.js","lineNumber":48,"sourceCode":"  lineNumber: string,\n  columnNumber: string,\n|};\n\n// https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-PositionTickInfo\ntype PositionTickInfo = {|\n  line: number,\n  ticks: number,\n|};\n\nexport default class SamplingProfiler {\n  session: Session;\n\n  startProfiling(): Promise<mixed> {\n    let inspector;\n    try {\n      inspector = require('inspector');\n    } catch (err) {\n      throw new ThrowableDiagnostic({\n        diagnostic: {\n          message: `The inspector module isn't available`,\n          origin: '@parcel/workers',\n          hints: ['Disable build profiling'],\n        },\n      });\n    }\n\n    this.session = new inspector.Session();\n    this.session.connect();\n\n    return Promise.all([\n      this.sendCommand('Profiler.setSamplingInterval', {\n        interval: 100,\n      }),\n      this.sendCommand('Profiler.enable'),\n      this.sendCommand('Profiler.start'),\n    ]);","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/profiler/src/SamplingProfiler.js#L30-L66","documentation":"Thrown by SamplingProfiler.startProfiling when Node's built-in 'inspector' module cannot be required. Parcel's profiler uses the V8 inspector session API to collect sampling profiles during a build. If require('inspector') throws, the CPU profiling feature is unavailable on the current runtime, so Parcel aborts startup with a ThrowableDiagnostic rather than silently disabling profiling.","triggerScenarios":"Calling the build with profiling enabled (e.g. PARCEL_PROFILE=true or the profiler API) on a runtime that ships without the inspector module — typically a stripped/custom Node build, an older Node version (< 8.0.0), or a non-Node environment bundling @parcel/workers.","commonSituations":"Running Parcel under a minimal Node runtime (Alpine musl images missing inspector, embedded runtimes like Bun/Den incompatibility), Node.js built with --without-inspector, or attempting to profile inside a sandbox that blocks the inspector. Also seen when a bundler inlines @parcel/workers into a browser bundle where inspector is absent.","solutions":["Disable build profiling: remove the PARCEL_PROFILE env var / profiling flag and rebuild.","Upgrade to a standard Node.js LTS distribution (>= 10) that includes the inspector module — verify with `node -e \"require('inspector')\"`.","If on Alpine/musl, switch to an official Node image or one known to ship inspector.","If you need profiling, run Parcel under a full Node.js installation outside the restricted sandbox."],"exampleFix":"// before\nPARCEL_PROFILE=true parcel build src/index.html\n\n// after (profiling disabled)\nparcel build src/index.html","handlingStrategy":"validation","validationCode":"// Before enabling profiling, verify the inspector module is available.\nfunction canProfile() {\n  try { require('inspector'); return true; }\n  catch { return false; }\n}\nif (!canProfile()) {\n  console.warn('Profiling disabled: inspector module unavailable');\n  delete process.env.PARCEL_PROFILE;\n}","typeGuard":null,"tryCatchPattern":"// Wrap the profiling-enabled build; degrade gracefully if unsupported.\ntry {\n  await profiler.startProfiling();\n} catch (e) {\n  if (/inspector module isn't available/.test(e.message)) {\n    // proceed without profiling\n  } else { throw e; }\n}","preventionTips":["Gate profiling behind a runtime capability check, not just an env flag.","Use a full Node.js LTS distribution in CI/images that include the inspector.","Document that profiling requires Node, not alternate runtimes."],"tags":["node-runtime","profiling","inspector","parcel-workers"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}