{"record":{"id":"cbbaf4564274de3f","repo":"moeru-ai/airi","slug":"kit-kitid-is-not-available-for-runtime-run","errorCode":null,"errorMessage":"Kit `${kitId}` is not available for runtime `${runtime}`.","messagePattern":"Kit `(.+?)` is not available for runtime `(.+?)`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugin-sdk/src/plugin-host/core.ts","lineNumber":575,"sourceCode":"  }\n\n  private getModuleOrThrow(moduleId: string) {\n    const module = this.modules.get(moduleId)\n    if (!module) {\n      throw new Error(`Module \\`${moduleId}\\` was not found.`)\n    }\n\n    return module\n  }\n\n  private assertKitAvailableForRuntime(kitId: string, runtime: PluginRuntime) {\n    const kit = this.kits.get(kitId)\n    if (!kit) {\n      throw new Error(`Kit \\`${kitId}\\` is not registered.`)\n    }\n\n    if (!kit.runtimes.includes(runtime)) {\n      throw new Error(`Kit \\`${kitId}\\` is not available for runtime \\`${runtime}\\`.`)\n    }\n\n    return kit\n  }\n\n  listSessions() {\n    return this.extensionSessionService.list()\n  }\n\n  getSession(sessionId: string) {\n    return this.extensionSessionService.get(sessionId)\n  }\n\n  registerKit(kit: KitDescriptor) {\n    return this.kits.register(kit)\n  }\n\n  unregisterKit(kitId: string) {","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/packages/plugin-sdk/src/plugin-host/core.ts#L557-L593","documentation":"Thrown by assertKitAvailableForRuntime() when the kit exists in the registry but its `runtimes` array does not include the runtime of the current session (or the host default runtime). This prevents binding a kit to a runtime it was not declared to support.","triggerScenarios":"Calling announceBinding or bindExtensionKitModule where the session.runtime (or host default `this.runtime`, which defaults to 'electron') is not in the kit descriptor's runtimes list. E.g. a kit declared with runtimes: ['web'] but the host/session runtime is 'electron'.","commonSituations":"Kit descriptor was registered with a restrictive runtimes list (e.g. only ['web']) but the host runs as 'electron' (the default). Or a node-runtime test tries to use an electron-only kit. Mismatched runtime between host constructor (options.runtime) and kit declaration.","solutions":["Add the target runtime to the kit descriptor's runtimes array when registering it (e.g. [...runtimes, 'electron']).","Construct the ExtensionHost with the matching runtime (new ExtensionHost({ runtime: 'web' })) if the kit only supports that runtime.","Pass options.runtime to host.start(manifest, { runtime }) so the session uses a runtime the kit supports."],"exampleFix":"// before — kit only declares web, host defaults to electron\nhost.registerKit({ kitId: 'kit.gamelet', runtimes: ['web'], capabilities: [] })\nhost.announceBinding(sessionId, { kitId: 'kit.gamelet', ... }) // session runtime is 'electron'\n\n// after — align runtimes\nhost.registerKit({ kitId: 'kit.gamelet', runtimes: ['web', 'electron'], capabilities: [] })","handlingStrategy":"validation","validationCode":"const kit = host.getKit(kitId)\nif (!kit) throw new Error(`Kit '${kitId}' not registered`)\nconst targetRuntime = session.runtime ?? 'electron'\nif (!kit.runtimes.includes(targetRuntime)) {\n  throw new Error(`Kit '${kitId}' does not support runtime '${targetRuntime}'`)\n}\nhost.announceBinding(sessionId, { kitId, ... })","typeGuard":"function kitSupportsRuntime(kit: { runtimes: string[] }, runtime: string): boolean {\n  return kit.runtimes.includes(runtime)\n}","tryCatchPattern":"try {\n  host.announceBinding(sessionId, { kitId, ... })\n} catch (error) {\n  if (error instanceof Error && /not available for runtime/.test(error.message)) {\n    // widen the kit's runtimes or switch the session/host runtime\n  } else {\n    throw error\n  }\n}","preventionTips":["When registering a kit, include every runtime the host may run as in the runtimes array.","Keep the host constructor runtime (or per-start runtime) aligned with the kits you bind.","Test kit binding under each runtime the kit claims to support."],"tags":["kit","runtime","compatibility","binding"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}