parcel-bundler/parcel · error · Error

Parcel is not profiling

Error message

Parcel is not profiling

What it means

`stopProfiling` is the counterpart to `startProfiling`. It requires `isProfiling` to be true because it must flush and collect the worker-farm profile that was started. Stopping with no active session has no profile to return and would yield undefined behavior.

Source

Thrown at packages/core/core/src/Parcel.js:460

    return nullthrows(
      this.#resolvedOptions,
      'Resolved options is null, please let parcel initialize before accessing this.',
    );
  }

  async startProfiling(): Promise<void> {
    if (this.isProfiling) {
      throw new Error('Parcel is already profiling');
    }

    logger.info({origin: '@parcel/core', message: 'Starting profiling...'});
    this.isProfiling = true;
    await this.#farm.startProfile();
  }

  stopProfiling(): Promise<void> {
    if (!this.isProfiling) {
      throw new Error('Parcel is not profiling');
    }

    logger.info({origin: '@parcel/core', message: 'Stopping profiling...'});
    this.isProfiling = false;
    return this.#farm.endProfile();
  }

  takeHeapSnapshot(): Promise<void> {
    logger.info({origin: '@parcel/core', message: 'Taking heap snapshot...'});
    return this.#farm.takeHeapSnapshot();
  }

  async unstable_transform(
    options: ParcelTransformOptions,
  ): Promise<Array<Asset>> {
    if (!this.#initialized) {
      await this._init();
    }

View on GitHub (pinned to 59484858a1)

Solutions

  1. Only call stop after a successful start.
  2. Guard with `if (parcel.isProfiling)` before stopping.
  3. Track the started state in your own flag if you cannot rely on `isProfiling`.

Example fix

// before
await parcel.stopProfiling();

// after
if (parcel.isProfiling) await parcel.stopProfiling();
Defensive patterns

Strategy: validation

Validate before calling

// Guard stop so it only runs when a session is active.
if (parcel.isProfiling) await parcel.stopProfiling();

Type guard

function canStopProfiling(p: {isProfiling: boolean}): boolean {
  return p.isProfiling === true;
}

Try / catch

try {
  await parcel.startProfiling();
  // ... work
} finally {
  if (parcel.isProfiling) await parcel.stopProfiling();
}

Prevention

When it happens

Trigger: Calling `parcel.stopProfiling()` before any successful `startProfiling()`.

Common situations: Finally-blocks or teardown hooks that stop profiling defensively even when start failed or was skipped.

Related errors


AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13). Data as JSON: /api/errors/d192f74aafcb6900. Report an issue: GitHub.