{"record":{"id":"ccd195ac8b447710","repo":"moeru-ai/airi","slug":"unknown-plugin-transport-kind-ccd195","errorCode":null,"errorMessage":"Unknown plugin transport kind.","messagePattern":"Unknown plugin transport kind\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugin-sdk/src/plugin-host/runtimes/web/index.ts","lineNumber":36,"sourceCode":" * - `transport` describes a transport supported by the web runtime\n *\n * Returns:\n * - A web-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 web runtime yet.')\n    case 'web-worker':\n      throw new Error('Web worker transport is not implemented yet.')\n    case 'node-worker':\n      throw new Error('Node worker transport is not available in web runtime.')\n    case 'electron':\n      throw new Error('Electron transport is not available in web runtime.')\n    default:\n      throw new Error('Unknown plugin transport kind.')\n  }\n}\n","sourceCodeStart":18,"sourceCodeEnd":39,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/packages/plugin-sdk/src/plugin-host/runtimes/web/index.ts#L18-L39","documentation":"Thrown by the `default` branch of the transport switch in the web runtime's `createPluginContext()`. It fires when `transport.kind` is not one of the known cases (`in-memory`, `websocket`, `web-worker`, `node-worker`, `electron`). Because the switch is exhaustive over a union, this typically indicates a value outside the union or a stale/distinct transport type.","triggerScenarios":"Passing a transport object whose `kind` is undefined, misspelled, or a newly added transport kind not yet handled by the web runtime. Also triggered by malformed config that omits `kind` entirely.","commonSituations":"Adding a new transport kind to the union without updating the web-runtime switch; config loaded from a source with a typo in the kind string; passing a plain object without a `kind` field; version skew between the transport type definitions and the web runtime implementation.","solutions":["Ensure `transport.kind` is one of the supported web-runtime values (currently `in-memory`); check the value before calling `createPluginContext`.","If you extended the `PluginTransport` union with a new kind, add a case to the switch (or explicitly throw a clearer message) rather than relying on default.","Validate the config object shape (presence and value of `kind`) before constructing the context.","Check for version mismatch between the plugin-sdk transport type definitions and the web runtime build."],"exampleFix":"// before\nconst ctx = createPluginContext({ kind: 'memory-local' } as any)\n\n// after\nconst ctx = createPluginContext({ kind: 'in-memory' })","handlingStrategy":"type-guard","validationCode":"const knownKinds = new Set(['in-memory', 'websocket', 'web-worker', 'node-worker', 'electron'])\nif (!knownKinds.has(transport.kind)) {\n  throw new Error(`Unknown transport kind: ${transport.kind}`)\n}\nconst ctx = createPluginContext(transport)","typeGuard":"const WEB_TRANSPORT_KINDS = ['in-memory'] as const\ntype WebTransportKind = (typeof WEB_TRANSPORT_KINDS)[number]\n\nfunction isWebTransportKind(t: PluginTransport): t is { kind: WebTransportKind } {\n  return (WEB_TRANSPORT_KINDS as readonly string[]).includes(t.kind)\n}","tryCatchPattern":"try {\n  ctx = createPluginContext(transport)\n} catch (e) {\n  if (e instanceof Error && e.message === 'Unknown plugin transport kind.') {\n    ctx = createPluginContext({ kind: 'in-memory' })\n  } else throw e\n}","preventionTips":["Always set transport.kind to one of the supported values; never construct transport objects with as any.","When extending the PluginTransport union, update every runtime switch (or add a shared exhaustive handler).","Validate config shape (presence and value of kind) before constructing a plugin context.","Keep the plugin-sdk version in sync across the host and transport type definitions."],"tags":["plugin-sdk","web-runtime","transport","exhaustive-switch","type-safety"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}