{"record":{"id":"8350d1770b7c2109","repo":"moeru-ai/airi","slug":"web-worker-transport-is-not-available-in-node-runt","errorCode":null,"errorMessage":"Web worker transport is not available in node runtime.","messagePattern":"Web worker transport is not available in node runtime\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugin-sdk/src/plugin-host/runtimes/node/index.ts","lineNumber":35,"sourceCode":" *\n * Expects:\n * - `transport` describes a transport supported by the node runtime\n *\n * Returns:\n * - A node-compatible Eventa context, or throws if the transport is not implemented\n */\nexport function createPluginContext(transport: PluginTransport): EventContext<any, any> {\n  switch (transport.kind) {\n    case 'in-memory':\n      return createContext()\n    case 'websocket':\n      throw new Error('WebSocket transport is not implemented for node runtime yet.')\n    case 'node-worker':\n      throw new Error('Node worker transport is not implemented yet.')\n    case 'electron':\n      throw new Error('Electron transport is not implemented yet.')\n    case 'web-worker':\n      throw new Error('Web worker transport is not available in node runtime.')\n    default:\n      throw new Error('Unknown plugin transport kind.')\n  }\n}\n","sourceCodeStart":17,"sourceCodeEnd":40,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/plugin-sdk/src/plugin-host/runtimes/node/index.ts#L17-L40","documentation":"Thrown by createPluginContext in the node runtime when transport.kind === 'web-worker'. Unlike the 'not implemented yet' cases, this is a permanent availability rule: Web Workers are a browser API and cannot exist in Node, so the node runtime rejects the kind outright rather than treating it as pending work.","triggerScenarios":"Passing { kind: 'web-worker' } to createPluginContext in a Node process; isomorphic code that picks web-worker when typeof window !== 'undefined' logic is inverted; config written for the web host being reused by a Node host.","commonSituations":"Sharing transport config between web and node entrypoints; environment detection bugs that select the browser transport server-side; copy-pasted bootstrap from a web plugin host into a Node script or test.","solutions":["Use { kind: 'in-memory' } in Node; keep 'web-worker' only for the web runtime host.","Fix environment-based transport selection so Node never resolves to a browser-only kind.","Assert the resolved transport against a per-runtime allowlist before calling createPluginContext so mistakes surface in your own error message."],"exampleFix":"// before\nconst ctx = createPluginContext({ kind: 'web-worker' }) // node runtime: throws\n\n// after\nconst ctx = createPluginContext({ kind: 'in-memory' })","handlingStrategy":"type-guard","validationCode":"if (transport.kind === 'web-worker') {\n  throw new Error('web-worker transport is browser-only; node host must use in-memory')\n}","typeGuard":"const isBrowserOnlyKind = (t: PluginTransport): boolean => t.kind === 'web-worker'\n// in node bootstrap: if (isBrowserOnlyKind(transport)) fail fast with your own message","tryCatchPattern":null,"preventionTips":["Keep per-runtime transport config files (node vs web) instead of one shared object.","Add unit tests asserting the node bootstrap never receives browser-only kinds."],"tags":["plugin-sdk","transport","web-worker","node-runtime","wrong-environment"],"backgroundTag":"unsupported-transport-kind","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}