{"record":{"id":"265b26c46d96c0e9","repo":"parcel-bundler/parcel","slug":"worker-send-back-a-reference-to-a-missing-dev-dep","errorCode":null,"errorMessage":"Worker send back a reference to a missing dev dep request.\nThis might happen due to internal in-memory build caches not being cleared\nbetween builds or due a race condition.\nThis is a bug in Parcel.","messagePattern":"Worker send back a reference to a missing dev dep request\\.\nThis might happen due to internal in-memory build caches not being cleared\nbetween builds or due a race condition\\.\nThis is a bug in Parcel\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/core/src/requests/DevDepRequest.js","lineNumber":244,"sourceCode":"        resolveFrom: devDepRequest.resolveFrom,\n        hash: devDepRequest.hash,\n        additionalInvalidations: devDepRequest.additionalInvalidations,\n      });\n    },\n    input: null,\n  });\n}\n\nconst devDepRequests: Map<string, DevDepRequest> = createBuildCache();\nexport function resolveDevDepRequestRef(\n  devDepRequestRef: DevDepRequest | DevDepRequestRef,\n): DevDepRequest {\n  const devDepRequest =\n    devDepRequestRef.type === 'ref'\n      ? devDepRequests.get(devDepRequestRef.hash)\n      : devDepRequestRef;\n  if (devDepRequest == null) {\n    throw new Error(\n      `Worker send back a reference to a missing dev dep request.\nThis might happen due to internal in-memory build caches not being cleared\nbetween builds or due a race condition.\nThis is a bug in Parcel.`,\n    );\n  }\n\n  if (devDepRequestRef.type !== 'ref') {\n    devDepRequests.set(devDepRequest.hash, devDepRequest);\n  }\n\n  return devDepRequest;\n}\n\n// A cache of plugin dependency hashes that we've already sent to the main thread.\n// Automatically cleared before each build.\nconst pluginCache = createBuildCache();\n","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/core/src/requests/DevDepRequest.js#L226-L262","documentation":"Thrown by resolveDevDepRequestRef when a worker thread sends back a DevDepRequestRef (a lightweight {type:'ref', hash} pointer) but the main thread's in-memory devDepRequests Map has no entry for that hash. The message itself states this is an internal Parcel bug caused by stale build caches or a race between worker and main thread, not a user configuration error.","triggerScenarios":"Called during multi-threaded builds when a worker serializes a DevDepRequest as a ref and the main thread calls resolveDevDepRequestRef(ref) to dereference it. The lookup devDepRequests.get(devDepRequestRef.hash) returns undefined because the hash was never registered (the if (devDepRequestRef.type !== 'ref') branch that populates the map was skipped or ran in a different process).","commonSituations":"Long-running parcel watch sessions where the in-memory cache survives across rebuilds; HMR/dev server restarts that don't fully tear down workers; upgrading Parcel across a version that changed the DevDepRequest hashing scheme while old cache entries linger; custom plugins that create dev dep requests from worker threads.","solutions":["Clear the Parcel cache: rm -rf .parcel-cache and node_modules/.cache, then rebuild.","Restart the dev server / watch process from scratch so in-memory build caches are re-initialized.","Upgrade to the latest patch release of @parcel/core — this is an acknowledged internal bug that has seen fixes across versions.","If reproducing consistently, file a bug report at https://github.com/parcel-bundler/parcel with the minimal reproduction, Parcel version, and plugin list.","As a temporary workaround, run builds single-threaded (set PARCEL_WORKERS=0 or workers: 0 in serve/build options) to avoid the worker-main cache desync."],"exampleFix":"// before (cache may be stale after upgrade)\nparcel build src/index.html\n\n// after (force fresh cache + single worker to dodge the race)\nrm -rf .parcel-cache && PARCEL_WORKERS=0 parcel build src/index.html","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// This is an internal Parcel bug — catching it to retry with a clean cache\nconst { rmSync } = require('fs');\nasync function buildWithRetry(options, maxRetries = 1) {\n  for (let attempt = 0; attempt <= maxRetries; attempt++) {\n    try {\n      return await new Parcel(options).run();\n    } catch (e) {\n      if (attempt < maxRetries && /missing dev dep request/i.test(e.message)) {\n        rmSync('.parcel-cache', { recursive: true, force: true });\n        continue;\n      }\n      throw e;\n    }\n  }\n}","preventionTips":["Clear .parcel-cache after upgrading Parcel versions.","Restart the dev server periodically during long watch sessions.","Pin Parcel to a known-stable patch version rather than floating ranges.","Set workers: 0 for CI builds if you encounter worker-related cache desync issues."],"tags":["parcel-internal","worker-thread","cache","race-condition","dev-deps"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}