ruvnet/ruflo · error · Error

TransportManager already running

Error message

TransportManager already running

What it means

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.

Source

Thrown at v3/@claude-flow/mcp/src/transport/index.ts:140

    }

    await transport.stop();
    this.transports.delete(name);
    this.logger.debug('Transport removed', { name });
    return true;
  }

  getTransport(name: string): ITransport | undefined {
    return this.transports.get(name);
  }

  getTransportNames(): string[] {
    return Array.from(this.transports.keys());
  }

  async startAll(): Promise<void> {
    if (this.running) {
      throw new Error('TransportManager already running');
    }

    this.logger.info('Starting all transports', { count: this.transports.size });

    const startPromises = Array.from(this.transports.entries()).map(
      async ([name, transport]) => {
        try {
          await transport.start();
          this.logger.info('Transport started', { name, type: transport.type });
        } catch (error) {
          this.logger.error('Failed to start transport', { name, error });
          throw error;
        }
      }
    );

    await Promise.all(startPromises);
    this.running = true;

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Guard with the public isRunning(): if (!manager.isRunning()) await manager.startAll()
  2. Call await manager.stopAll() before restarting the manager
  3. Create a new TransportManager per application lifecycle instead of restarting a shared one

Example fix

// before
await manager.startAll();

// after
if (!manager.isRunning()) {
  await manager.startAll();
}
Defensive patterns

Strategy: validation

Validate before calling

if (!manager.isRunning()) {
  await manager.startAll();
}

Try / catch

try {
  await manager.startAll();
} catch (e) {
  if (e instanceof Error && e.message === 'TransportManager already running') {
    // already started - no-op
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: beforeEach hooks that start but never stop; health-check or 'ensure started' endpoints calling startAll(); double initialization in main() and a worker.

Related errors


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/ec894017c8ce0572. Report an issue: GitHub.