{"record":{"id":"a9c8e733867a3891","repo":"ruvnet/ruflo","slug":"agent-with-id-config-id-already-exists","errorCode":null,"errorMessage":"Agent with ID ${config.id} already exists","messagePattern":"Agent with ID (.+?) already exists","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/shared/src/core/orchestrator/lifecycle-manager.ts","lineNumber":100,"sourceCode":"  private pool: IAgentPool;\n\n  constructor(\n    private eventBus: IEventBus,\n    private config: LifecycleManagerConfig,\n    pool?: IAgentPool,\n  ) {\n    this.pool = pool ?? new AgentPool();\n  }\n\n  async spawn(config: IAgentConfig): Promise<IAgent> {\n    // Validate capacity\n    if (!this.pool.hasCapacity(this.config.maxConcurrentAgents)) {\n      throw new Error('Maximum concurrent agents reached');\n    }\n\n    // Validate agent doesn't already exist\n    if (this.pool.get(config.id)) {\n      throw new Error(`Agent with ID ${config.id} already exists`);\n    }\n\n    const agent: IAgent = {\n      id: config.id,\n      name: config.name,\n      type: config.type,\n      config,\n      createdAt: new Date(),\n      status: 'spawning',\n      currentTaskCount: 0,\n      lastActivity: new Date(),\n      metrics: {\n        tasksCompleted: 0,\n        tasksFailed: 0,\n        avgTaskDuration: 0,\n        errorCount: 0,\n        uptime: 0,\n      },","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/shared/src/core/orchestrator/lifecycle-manager.ts#L82-L118","documentation":"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.","triggerScenarios":"Thrown at v3/@claude-flow/shared/src/core/orchestrator/lifecycle-manager.ts:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a unique agent id (e.g. a generated UUID) when creating the agent.","Check whether the agent already exists and reuse or terminate it first."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}