moeru-ai/airi · info · Error

WebSocket transport is not implemented for web runtime yet.

Error message

WebSocket transport is not implemented for web runtime yet.

What it means

Thrown by `createPluginContext()` in the web runtime when `transport.kind === 'websocket'`. The web runtime currently only implements the `in-memory` transport; WebSocket support for browser plugins is planned but not yet built. This is a deliberate unimplemented-feature guard, not a runtime failure of an existing capability.

Source

Thrown at packages/plugin-sdk/src/plugin-host/runtimes/web/index.ts:28

/**
 * Creates the Eventa context used by web-side extension host sessions.
 *
 * Use when:
 * - Bootstrapping a web runtime extension session
 *
 * Expects:
 * - `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

  1. Use `createPluginContext({ kind: 'in-memory' })` for web-runtime plugin contexts until WebSocket support ships.
  2. If you need cross-tab/window plugin IPC on web, layer a custom transport on top of in-memory contexts (e.g. BroadcastChannel) rather than selecting 'websocket'.
  3. Track and await the web WebSocket transport implementation; do not attempt to work around it by patching the switch.
  4. Confirm the runtime you are actually targeting — Node and Electron hosts may support transports that web does not.

Example fix

// before
const ctx = createPluginContext({ kind: 'websocket', url })

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

Strategy: validation

Validate before calling

const supportedWebKinds = new Set(['in-memory'])
if (!supportedWebKinds.has(transport.kind)) {
  throw new Error(`Transport '${transport.kind}' is not supported in the web runtime.`)
}
const ctx = createPluginContext(transport)

Type guard

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

Try / catch

try {
  ctx = createPluginContext(transport)
} catch (e) {
  if (e instanceof Error && /not implemented.*web runtime|not available in web runtime/i.test(e.message)) {
    ctx = createPluginContext({ kind: 'in-memory' })
  } else throw e
}

Prevention

When it happens

Trigger: Constructing a web plugin context with `createPluginContext({ kind: 'websocket', ... })`. Any browser/host code that selects a WebSocket transport for plugin IPC on the web runtime hits this immediately at context creation.

Common situations: Porting an Electron or Node plugin host configuration to the web runtime without changing the transport kind; config defaults that assume WebSocket is universally available; exploring web plugin support before the transport is implemented.

Related errors


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