{"record":{"id":"abb2a21c0ad7eb92","repo":"deepseek-ai/deepseek-harness","slug":"the-workflow-worker-entry-must-be-loaded-inside-a","errorCode":null,"errorMessage":"the workflow worker entry must be loaded inside a worker thread (no parentPort)","messagePattern":"the workflow worker entry must be loaded inside a worker thread \\(no parentPort\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/workflow/workflow-worker-thread/src/session.ts","lineNumber":129,"sourceCode":"    this.pending.get(callId)?.settled.reject(new Error(rendered))\n  }\n\n  /** The host acked the dispose; the call's book-keeping is complete. */\n  onChildDisposed(callId: number): void {\n    const entry = this.pending.get(callId)\n    this.pending.delete(callId)\n    entry?.disposed.resolve()\n  }\n}\n\n/**\n * Narrow the nullable `parentPort` the bootstrap reads from\n * `node:worker_threads`.\n * @param port - `parentPort` as imported (null on the main thread).\n * @returns the port, non-null.\n */\nexport function requireParentPort(port: MessagePort | null): MessagePort {\n  if (port === null) throw new Error('the workflow worker entry must be loaded inside a worker thread (no parentPort)')\n  return port\n}\n\n/**\n * Run one workflow script to settlement against `port`, posting the terminal result message\n * exactly once; resolves after that post (stray children may still be winding down through the\n * port — the host owns their teardown and ultimately terminates the thread). It never rejects:\n * constructor failure becomes an error result. Host pre-parse makes syntax failure here a likely\n * Node-version skew, but the session still reports it instead of dying silently.\n * @param port - the channel to the host (the real `parentPort`, or one side\n *   of an in-process `MessageChannel` in tests).\n * @param init - the run payload the host provided as `workerData`.\n */\nexport async function runWorkerSession(port: MessagePort, init: WorkerInit): Promise<void> {\n  const post: Post = (type, payload) => {\n    port.postMessage({ type, ...payload })\n  }\n  const children = new ChildRpcBridge(post)","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/workflow/workflow-worker-thread/src/session.ts#L111-L147","documentation":"Error \"the workflow worker entry must be loaded inside a worker thread (no parentPort)\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/workflow/workflow-worker-thread/src/session.ts:129 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Load the worker entry only through the workflow host's worker-thread spawn; do not import it directly in the main thread."],"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"}