{"record":{"id":"b616ee4554dcca10","repo":"deepseek-ai/deepseek-harness","slug":"workflow-worker-thread-postmessage-failed-rend","errorCode":null,"errorMessage":"workflow-worker-thread: postMessage failed: ${renderThrown(error)}","messagePattern":"workflow-worker-thread: postMessage failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/workflow/workflow-worker-thread/src/host.ts","lineNumber":264,"sourceCode":"    })().then(\n      () => { claimed.resolve(undefined) },\n      /* v8 ignore next -- result/quiescence never reject and Worker.terminate is the only external promise */\n      (error: unknown) => { claimed.reject(error) },\n    )\n    return this.disposed\n  }\n\n  /** Post one message to the worker (payload looked up from the tag's map entry), tolerating a thread that is already gone. */\n  private post<T extends HostToWorkerType>(type: T, payload: HostToWorkerPayloads[T]): void {\n    if (this.workerGone || this.workerDeathObserved) return\n    try {\n      this.worker.postMessage({ type, ...payload })\n    } catch (error: unknown) {\n      // Only a teardown race can land here (every engine message is JSON\n      // data, so serialization cannot fail); there is nothing left to\n      // deliver to — log and move on.\n      /* v8 ignore next -- postMessage teardown race (a throw between exit and its event): not constructible in-process */\n      this.ctx.logger.warn(`workflow-worker-thread: postMessage failed: ${renderThrown(error)}`)\n    }\n  }\n\n  private onMessage(message: WorkerToHostMessage): void {\n    // Node may emit `error`, then deliver an already-queued `message`, then\n    // emit `exit`. The first death signal is the host's logical delivery\n    // barrier: nothing arriving afterward may create a child, narrate after\n    // workflow/end, or compete with the chosen outcome.\n    if (this.workerDeathObserved) return\n    switch (message.type) {\n      case WorkerToHostType.Ready:\n        this.post(HostToWorkerType.Go, {})\n        break\n      case WorkerToHostType.Phase:\n        // Post-cancel narration is suppressed host-side: worker-side the\n        // hooks throw once the cancel message is PROCESSED, but narration\n        // already in flight (or emitted while the cancel crossed the\n        // boundary) must not reach observers — nothing is emitted after","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/workflow/workflow-worker-thread/src/host.ts#L246-L282","documentation":"Error \"workflow-worker-thread: postMessage failed: ${renderThrown(error)}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/workflow/workflow-worker-thread/src/host.ts:264 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the worker thread is still running; recreate the workflow worker if it exited or its port closed."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}