parcel-bundler/parcel · error · Error

Worker send back a reference to a missing dev dep request. T

Error message

Worker send back a reference to a missing dev dep request.
This might happen due to internal in-memory build caches not being cleared
between builds or due a race condition.
This is a bug in Parcel.

What it means

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.

Source

Thrown at packages/core/core/src/requests/DevDepRequest.js:244

        resolveFrom: devDepRequest.resolveFrom,
        hash: devDepRequest.hash,
        additionalInvalidations: devDepRequest.additionalInvalidations,
      });
    },
    input: null,
  });
}

const devDepRequests: Map<string, DevDepRequest> = createBuildCache();
export function resolveDevDepRequestRef(
  devDepRequestRef: DevDepRequest | DevDepRequestRef,
): DevDepRequest {
  const devDepRequest =
    devDepRequestRef.type === 'ref'
      ? devDepRequests.get(devDepRequestRef.hash)
      : devDepRequestRef;
  if (devDepRequest == null) {
    throw new Error(
      `Worker send back a reference to a missing dev dep request.
This might happen due to internal in-memory build caches not being cleared
between builds or due a race condition.
This is a bug in Parcel.`,
    );
  }

  if (devDepRequestRef.type !== 'ref') {
    devDepRequests.set(devDepRequest.hash, devDepRequest);
  }

  return devDepRequest;
}

// A cache of plugin dependency hashes that we've already sent to the main thread.
// Automatically cleared before each build.
const pluginCache = createBuildCache();

View on GitHub (pinned to 59484858a1)

Solutions

  1. Clear the Parcel cache: rm -rf .parcel-cache and node_modules/.cache, then rebuild.
  2. Restart the dev server / watch process from scratch so in-memory build caches are re-initialized.
  3. Upgrade to the latest patch release of @parcel/core — this is an acknowledged internal bug that has seen fixes across versions.
  4. If reproducing consistently, file a bug report at https://github.com/parcel-bundler/parcel with the minimal reproduction, Parcel version, and plugin list.
  5. 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.

Example fix

// before (cache may be stale after upgrade)
parcel build src/index.html

// after (force fresh cache + single worker to dodge the race)
rm -rf .parcel-cache && PARCEL_WORKERS=0 parcel build src/index.html
Defensive patterns

Strategy: retry

Try / catch

// This is an internal Parcel bug — catching it to retry with a clean cache
const { rmSync } = require('fs');
async function buildWithRetry(options, maxRetries = 1) {
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
    try {
      return await new Parcel(options).run();
    } catch (e) {
      if (attempt < maxRetries && /missing dev dep request/i.test(e.message)) {
        rmSync('.parcel-cache', { recursive: true, force: true });
        continue;
      }
      throw e;
    }
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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