parcel-bundler/parcel · error · ThrowableDiagnostic
The inspector module isn't available
Error message
The inspector module isn't available
What it means
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.
Source
Thrown at packages/core/profiler/src/SamplingProfiler.js:48
lineNumber: string,
columnNumber: string,
|};
// https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-PositionTickInfo
type PositionTickInfo = {|
line: number,
ticks: number,
|};
export default class SamplingProfiler {
session: Session;
startProfiling(): Promise<mixed> {
let inspector;
try {
inspector = require('inspector');
} catch (err) {
throw new ThrowableDiagnostic({
diagnostic: {
message: `The inspector module isn't available`,
origin: '@parcel/workers',
hints: ['Disable build profiling'],
},
});
}
this.session = new inspector.Session();
this.session.connect();
return Promise.all([
this.sendCommand('Profiler.setSamplingInterval', {
interval: 100,
}),
this.sendCommand('Profiler.enable'),
this.sendCommand('Profiler.start'),
]);View on GitHub (pinned to 59484858a1)
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.
Example fix
// before PARCEL_PROFILE=true parcel build src/index.html // after (profiling disabled) parcel build src/index.html
Defensive patterns
Strategy: validation
Validate before calling
// Before enabling profiling, verify the inspector module is available.
function canProfile() {
try { require('inspector'); return true; }
catch { return false; }
}
if (!canProfile()) {
console.warn('Profiling disabled: inspector module unavailable');
delete process.env.PARCEL_PROFILE;
} Try / catch
// Wrap the profiling-enabled build; degrade gracefully if unsupported.
try {
await profiler.startProfiling();
} catch (e) {
if (/inspector module isn't available/.test(e.message)) {
// proceed without profiling
} else { throw e; }
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Parcel is already profiling
- Parcel is not profiling
- Please provide a worker path!
- No dynamic require possible: ${workerPath}
AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13).
Data as JSON: /api/errors/12c7ac3996b3bf7d.
Report an issue: GitHub.