gatsbyjs/gatsby · error · Error

Received message about completed job that wasn't scheduled b

Error message

Received message about completed job that wasn't scheduled by this worker

What it means

initJobsMessagingInWorker looks up the deferred promise registered when this worker scheduled a job, but none exists for the completed job id — meaning the main process reported completion for a job this worker never created (or already handled). An internal messaging-consistency guard.

Source

Thrown at packages/gatsby/src/utils/jobs/worker-messaging.ts:84

/**
 * This map is ONLY used in worker. It's purpose is to keep track of promises returned to plugins
 * when creating jobs (in worker context), so that we can resolve or reject those once main process
 * send back their status.
 */
const deferredWorkerPromises = new Map<
  InternalJob["id"],
  pDefer.DeferredPromise<Record<string, unknown>>
>()
const gatsbyWorkerMessenger = getMessenger()
export function initJobsMessagingInWorker(): void {
  if (isWorker && gatsbyWorkerMessenger) {
    gatsbyWorkerMessenger.onMessage(msg => {
      if (msg.type === MESSAGE_TYPES.JOB_COMPLETED) {
        const { id, result } = msg.payload
        const deferredPromise = deferredWorkerPromises.get(id)

        if (!deferredPromise) {
          throw new Error(
            `Received message about completed job that wasn't scheduled by this worker`
          )
        }

        deferredPromise.resolve(result)
        deferredWorkerPromises.delete(id)
      } else if (msg.type === MESSAGE_TYPES.JOB_FAILED) {
        const { id, error, stack } = msg.payload
        const deferredPromise = deferredWorkerPromises.get(id)

        if (!deferredPromise) {
          throw new Error(
            `Received message about failed job that wasn't scheduled by this worker`
          )
        }

        const errorObject = new WorkerError(error)
        if (stack) {

View on GitHub (pinned to e85d62f177)

Solutions

  1. Check for duplicate worker messaging initialization
  2. Report as a Gatsby bug with the job id and plugin involved
  3. Ensure jobs API is used only through the official jobs manager
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at packages/gatsby/src/utils/jobs/worker-messaging.ts:84 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/32f897648b84eba5. Report an issue: GitHub.