moeru-ai/airi · error · Error

Unknown plugin transport kind.

Error message

Unknown plugin transport kind.

What it means

Thrown by createPluginContext() in the node runtime adapter's default switch branch when transport.kind does not match any known case (in-memory, websocket, node-worker, electron, web-worker). This catches malformed, typo'd, or future transport kinds the adapter does not recognize.

Source

Thrown at packages/plugin-sdk/src/plugin-host/runtimes/node/index.ts:37

 * - `transport` describes a transport supported by the node runtime
 *
 * Returns:
 * - A node-compatible Eventa context, or throws if the transport is not implemented
 */
export function createPluginContext(transport: PluginTransport): EventContext<any, any> {
  switch (transport.kind) {
    case 'in-memory':
      return createContext()
    case 'websocket':
      throw new Error('WebSocket transport is not implemented for node runtime yet.')
    case 'node-worker':
      throw new Error('Node worker transport is not implemented yet.')
    case 'electron':
      throw new Error('Electron transport is not implemented yet.')
    case 'web-worker':
      throw new Error('Web worker transport is not available in node runtime.')
    default:
      throw new Error('Unknown plugin transport kind.')
  }
}

View on GitHub (pinned to 27111382b4)

Solutions

  1. Ensure transport.kind is exactly one of the supported literals for the node adapter: currently only 'in-memory' is implemented.
  2. If extending the union, update the node adapter switch before using the new kind.
  3. Validate transport.kind against the supported set before calling createPluginContext.

Example fix

// before
const ctx = createPluginContext({ kind: 'in_memory' }) // typo: underscore

// after
const ctx = createPluginContext({ kind: 'in-memory' })
Defensive patterns

Strategy: type-guard

Validate before calling

const supported = ['in-memory'] // node adapter implemented kinds
if (!supported.includes(transport.kind)) {
  throw new Error(`Unsupported transport kind '${transport.kind}' for node runtime`)
}
const ctx = createPluginContext(transport)

Type guard

function isKnownNodeTransportKind(transport: PluginTransport): boolean {
  return ['in-memory', 'websocket', 'node-worker', 'electron', 'web-worker'].includes(transport.kind)
}

function isImplementedNodeTransport(transport: PluginTransport): boolean {
  return transport.kind === 'in-memory'
}

Try / catch

try {
  ctx = createPluginContext(transport)
} catch (error) {
  if (error instanceof Error && /Unknown plugin transport kind/.test(error.message)) {
    // transport.kind was undefined/typo/unrecognized; fall back to in-memory
    ctx = createPluginContext({ kind: 'in-memory' })
  } else {
    throw error
  }
}

Prevention

When it happens

Trigger: Calling createPluginContext() with a transport object whose `kind` is undefined, a typo (e.g. 'in_memory', 'WebSocket'), or a newly added union member the node adapter has not been updated to handle.

Common situations: Constructing the transport object dynamically and producing an invalid kind string. Version skew where a newer PluginTransport union adds a kind but the node adapter in the imported SDK version predates it. Forgetting to set `kind` entirely (undefined).

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/e8067aeee375f1a7. Report an issue: GitHub.