{"record":{"id":"1eb3d02bb6905b67","repo":"parcel-bundler/parcel","slug":"please-provide-a-worker-path","errorCode":null,"errorMessage":"Please provide a worker path!","messagePattern":"Please provide a worker path!","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/workers/src/WorkerFarm.js","lineNumber":103,"sourceCode":"  serializedSharedReferences: Map<SharedReference, ?ArrayBuffer> = new Map();\n  profiler: ?SamplingProfiler;\n\n  constructor(farmOptions: $Shape<FarmOptions> = {}) {\n    super();\n    this.options = {\n      maxConcurrentWorkers: WorkerFarm.getNumWorkers(),\n      maxConcurrentCallsPerWorker: WorkerFarm.getConcurrentCallsPerWorker(\n        farmOptions.shouldTrace ? 1 : DEFAULT_MAX_CONCURRENT_CALLS,\n      ),\n      forcedKillTime: 500,\n      warmWorkers: false,\n      useLocalWorker: true, // TODO: setting this to false makes some tests fail, figure out why\n      backend: detectBackend(),\n      ...farmOptions,\n    };\n\n    if (!this.options.workerPath) {\n      throw new Error('Please provide a worker path!');\n    }\n\n    // $FlowFixMe\n    if (process.browser) {\n      if (this.options.workerPath === '@parcel/core/src/worker.js') {\n        this.localWorker = coreWorker;\n      } else {\n        throw new Error(\n          'No dynamic require possible: ' + this.options.workerPath,\n        );\n      }\n    } else {\n      // $FlowFixMe this must be dynamic\n      this.localWorker = require(this.options.workerPath);\n    }\n\n    this.localWorkerInit =\n      this.localWorker.childInit != null ? this.localWorker.childInit() : null;","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/workers/src/WorkerFarm.js#L85-L121","documentation":"Thrown by WorkerFarm constructor when options.workerPath is falsy. The worker farm requires a path to the worker entry module to spawn child workers (or to load the local worker in-process); without it the farm cannot initialize, so it fails immediately.","triggerScenarios":"Constructing `new WorkerFarm({})` (or with an options object that omits workerPath); calling WorkerFarm.getFromOptions with a config missing the workerPath field; programmatic use of @parcel/workers without setting the worker entry.","commonSituations":"Custom integrations that spin up WorkerFarm directly; passing only farmOptions like maxConcurrentWorkers while forgetting workerPath; refactor that drops the field.","solutions":["Pass workerPath in options, e.g. `new WorkerFarm({ workerPath: require.resolve('@parcel/core/src/worker.js'), ... })`.","Use WorkerFarm.getShared() instead of constructing directly so Parcel fills in defaults.","If integrating programmatically, ensure your wrapper forwards workerPath from its caller."],"exampleFix":"// before\nconst farm = new WorkerFarm({ maxConcurrentWorkers: 4 });\n\n// after\nconst farm = new WorkerFarm({\n  workerPath: require.resolve('@parcel/core/src/worker.js'),\n  maxConcurrentWorkers: 4,\n});","handlingStrategy":"validation","validationCode":"if (!options.workerPath) {\n  throw new Error('workerPath is required by WorkerFarm');\n}\nconst farm = new WorkerFarm({ workerPath: require.resolve('@parcel/core/src/worker.js'), ...options });","typeGuard":"interface WorkerFarmOpts { workerPath: string; }\nfunction hasWorkerPath(o: unknown): o is WorkerFarmOpts {\n  return typeof (o as any)?.workerPath === 'string' && (o as any).workerPath.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Prefer WorkerFarm.getShared() over direct construction to inherit defaults.","Always set workerPath via require.resolve(...) so it is absolute and resolvable.","Unit-test your WorkerFarm wrapper with an explicit workerPath assertion."],"tags":["worker-farm","configuration","parcel-workers","api-usage"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}