ruvnet/ruflo · error

Maximum worker limit (${this.config.maxWorkers}) reached

Error message

Maximum worker limit (${this.config.maxWorkers}) reached

What it means

WorkerPool.spawn hit the configured maxWorkers ceiling: the pool already holds maxWorkers worker instances. This is a capacity guard protecting the host from unbounded worker creation; spawning more requires terminating an existing worker first.

Source

Thrown at v3/@claude-flow/plugins/src/workers/index.ts:365

      avgTaskDuration: 0,
    };
  }

  private startHealthChecks(): void {
    this.healthCheckTimer = setInterval(
      () => this.performHealthChecks(),
      this.config.healthCheckInterval
    );
  }

  private async performHealthChecks(): Promise<void> {
    const results = await this.healthCheck();
    this.emit(WORKER_EVENTS.HEALTH_CHECK, { results: Object.fromEntries(results) });
  }

  async spawn(definition: WorkerDefinition): Promise<IWorkerInstance> {
    if (this._workers.size >= this.config.maxWorkers) {
      throw new Error(`Maximum worker limit (${this.config.maxWorkers}) reached`);
    }

    const workerId = `worker-${this.nextWorkerId++}`;
    const worker = new WorkerInstance(workerId, definition);

    this._workers.set(workerId, worker);
    this.poolMetrics.totalWorkers++;
    this.poolMetrics.idleWorkers++;

    this.emit(WORKER_EVENTS.SPAWNED, { workerId, definition });

    return worker;
  }

  async terminate(workerId: string): Promise<void> {
    const worker = this._workers.get(workerId);
    if (!worker) {
      throw new Error(`Worker ${workerId} not found`);

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Release/terminate idle workers before spawning new ones.
  2. Increase maxWorkers to match expected concurrency.
  3. Queue work and reuse existing workers instead of spawning per task.
Defensive patterns

Strategy: validation

When it happens

Trigger: A new worker is requested when the pool already has config.maxWorkers workers.

Common situations: Burst of concurrent tasks, leaked workers never released, or maxWorkers set too low.


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