{"record":{"id":"ec894017c8ce0572","repo":"ruvnet/ruflo","slug":"transportmanager-already-running","errorCode":null,"errorMessage":"TransportManager already running","messagePattern":"TransportManager already running","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/mcp/src/transport/index.ts","lineNumber":140,"sourceCode":"    }\n\n    await transport.stop();\n    this.transports.delete(name);\n    this.logger.debug('Transport removed', { name });\n    return true;\n  }\n\n  getTransport(name: string): ITransport | undefined {\n    return this.transports.get(name);\n  }\n\n  getTransportNames(): string[] {\n    return Array.from(this.transports.keys());\n  }\n\n  async startAll(): Promise<void> {\n    if (this.running) {\n      throw new Error('TransportManager already running');\n    }\n\n    this.logger.info('Starting all transports', { count: this.transports.size });\n\n    const startPromises = Array.from(this.transports.entries()).map(\n      async ([name, transport]) => {\n        try {\n          await transport.start();\n          this.logger.info('Transport started', { name, type: transport.type });\n        } catch (error) {\n          this.logger.error('Failed to start transport', { name, error });\n          throw error;\n        }\n      }\n    );\n\n    await Promise.all(startPromises);\n    this.running = true;","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/mcp/src/transport/index.ts#L122-L158","documentation":"TransportManager.startAll() sets its own `running` flag and refuses a second invocation with 'TransportManager already running'; stopAll() resets it. The error indicates the manager was started twice without an intervening stop — typically duplicated init paths rather than a transport-level failure.","triggerScenarios":"Calling startAll() from bootstrap and again from a test setup hook; restart logic invoking startAll() after a partial failure without stopAll(); reusing a module-level manager across watch-mode reloads.","commonSituations":"beforeEach hooks that start but never stop; health-check or 'ensure started' endpoints calling startAll(); double initialization in main() and a worker.","solutions":["Guard with the public isRunning(): if (!manager.isRunning()) await manager.startAll()","Call await manager.stopAll() before restarting the manager","Create a new TransportManager per application lifecycle instead of restarting a shared one"],"exampleFix":"// before\nawait manager.startAll();\n\n// after\nif (!manager.isRunning()) {\n  await manager.startAll();\n}","handlingStrategy":"validation","validationCode":"if (!manager.isRunning()) {\n  await manager.startAll();\n}","typeGuard":null,"tryCatchPattern":"try {\n  await manager.startAll();\n} catch (e) {\n  if (e instanceof Error && e.message === 'TransportManager already running') {\n    // already started - no-op\n  } else {\n    throw e;\n  }\n}","preventionTips":["Use the public isRunning() guard before startAll()","Pair every startAll() with a stopAll() in teardown (afterEach/finally)","Create a new TransportManager per application lifecycle rather than restarting a shared one"],"tags":["transport","lifecycle","manager"],"backgroundTag":"already-running","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}