parcel-bundler/parcel · error · Error
Supplied WorkerFarm is ending
Error message
Supplied WorkerFarm is ending
What it means
Parcel can accept an externally-supplied WorkerFarm via `options.workerFarm` (e.g. to share workers across multiple Parcel instances). Before adopting it, Parcel checks the farm's `ending` flag: a farm that is already shutting down cannot accept new work and would deadlock the build. The check fails fast to surface the lifecycle misuse.
Source
Thrown at packages/core/core/src/Parcel.js:117
return;
}
await initSourcemaps;
await initRust?.();
let resolvedOptions: ParcelOptions = await resolveOptions(
this.#initialOptions,
);
this.#resolvedOptions = resolvedOptions;
let {config} = await loadParcelConfig(resolvedOptions);
this.#config = new ParcelConfig(config, resolvedOptions);
setFeatureFlags(resolvedOptions.featureFlags);
if (this.#initialOptions.workerFarm) {
if (this.#initialOptions.workerFarm.ending) {
throw new Error('Supplied WorkerFarm is ending');
}
this.#farm = this.#initialOptions.workerFarm;
} else {
this.#farm = createWorkerFarm({
shouldPatchConsole: resolvedOptions.shouldPatchConsole,
shouldTrace: resolvedOptions.shouldTrace,
});
}
await resolvedOptions.cache.ensure();
let {dispose: disposeOptions, ref: optionsRef} =
await this.#farm.createSharedReference(resolvedOptions, false);
this.#optionsRef = optionsRef;
this.#disposable = new Disposable();
if (this.#initialOptions.workerFarm) {
// If we don't own the farm, dispose of only these references whenView on GitHub (pinned to 59484858a1)
Solutions
- Do not call `workerFarm.end()` before passing it to a new Parcel instance.
- Create a fresh WorkerFarm via `createWorkerFarm()` for each independent Parcel, or omit `workerFarm` so Parcel manages its own.
- If sharing, end the farm only after all Parcel instances are disposed.
Example fix
// before
farm.end();
const p = new Parcel({workerFarm: farm});
// after
// drop the end() call, or create a new farm:
const p = new Parcel({workerFarm: createWorkerFarm()}); Defensive patterns
Strategy: validation
Validate before calling
// Reject an ending farm before handing it to Parcel.
if (options.workerFarm && options.workerFarm.ending) {
throw new Error('workerFarm is ending; create a new one');
} Type guard
function isActiveWorkerFarm(f: ?{ending?: boolean}): boolean {
return f != null && f.ending !== true;
} Prevention
- Never call farm.end() before reuse.
- Omit workerFarm to let Parcel own the lifecycle.
- Track farm ownership explicitly when sharing across Parcel instances.
When it happens
Trigger: Constructing `new Parcel({...workerFarm})` where `workerFarm.end()` was already called (or is mid-shutdown).
Common situations: Sharing one WorkerFarm across several Parcel instances and ending it after the first finishes; reusing a farm from a disposed Parcel.
Related errors
- Cannot add a worker call if workerfarm is ending.
- 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/591677a82965197c.
Report an issue: GitHub.