ruvnet/ruflo · error

Agent with ID ${config.id} already exists

Error message

Agent with ID ${config.id} already exists

What it means

LifecycleManager.spawn found an agent with the same config.id already in the pool. Agent ids must be unique; this fires on duplicate ids (double spawn or restart racing an existing agent), not on invalid configuration.

Source

Thrown at v3/@claude-flow/shared/src/core/orchestrator/lifecycle-manager.ts:100

  private pool: IAgentPool;

  constructor(
    private eventBus: IEventBus,
    private config: LifecycleManagerConfig,
    pool?: IAgentPool,
  ) {
    this.pool = pool ?? new AgentPool();
  }

  async spawn(config: IAgentConfig): Promise<IAgent> {
    // Validate capacity
    if (!this.pool.hasCapacity(this.config.maxConcurrentAgents)) {
      throw new Error('Maximum concurrent agents reached');
    }

    // Validate agent doesn't already exist
    if (this.pool.get(config.id)) {
      throw new Error(`Agent with ID ${config.id} already exists`);
    }

    const agent: IAgent = {
      id: config.id,
      name: config.name,
      type: config.type,
      config,
      createdAt: new Date(),
      status: 'spawning',
      currentTaskCount: 0,
      lastActivity: new Date(),
      metrics: {
        tasksCompleted: 0,
        tasksFailed: 0,
        avgTaskDuration: 0,
        errorCount: 0,
        uptime: 0,
      },

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Use a unique agent id (e.g. a generated UUID) when creating the agent.
  2. Check whether the agent already exists and reuse or terminate it first.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/@claude-flow/shared/src/core/orchestrator/lifecycle-manager.ts:100 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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