moeru-ai/airi · error · Error
Unknown plugin transport kind.
Error message
Unknown plugin transport kind.
What it means
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.
Source
Thrown at packages/plugin-sdk/src/plugin-host/runtimes/web/index.ts:36
* - `transport` describes a transport supported by the web runtime
*
* Returns:
* - A web-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 web runtime yet.')
case 'web-worker':
throw new Error('Web worker transport is not implemented yet.')
case 'node-worker':
throw new Error('Node worker transport is not available in web runtime.')
case 'electron':
throw new Error('Electron transport is not available in web runtime.')
default:
throw new Error('Unknown plugin transport kind.')
}
}
View on GitHub (pinned to 27111382b4)
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.
Example fix
// before
const ctx = createPluginContext({ kind: 'memory-local' } as any)
// after
const ctx = createPluginContext({ kind: 'in-memory' }) Defensive patterns
Strategy: type-guard
Validate before calling
const knownKinds = new Set(['in-memory', 'websocket', 'web-worker', 'node-worker', 'electron'])
if (!knownKinds.has(transport.kind)) {
throw new Error(`Unknown transport kind: ${transport.kind}`)
}
const ctx = createPluginContext(transport) Type guard
const WEB_TRANSPORT_KINDS = ['in-memory'] as const
type WebTransportKind = (typeof WEB_TRANSPORT_KINDS)[number]
function isWebTransportKind(t: PluginTransport): t is { kind: WebTransportKind } {
return (WEB_TRANSPORT_KINDS as readonly string[]).includes(t.kind)
} Try / catch
try {
ctx = createPluginContext(transport)
} catch (e) {
if (e instanceof Error && e.message === 'Unknown plugin transport kind.') {
ctx = createPluginContext({ kind: 'in-memory' })
} else throw e
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- WebSocket transport is not implemented for web runtime yet.
- Web worker transport is not implemented yet.
- Node worker transport is not available in web runtime.
- Electron transport is not available in web runtime.
- gameletKit requires a host binding runtime.
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/ccd195ac8b447710.
Report an issue: GitHub.