ruvnet/ruflo · error

Attempted to release unknown connection

Error message

Attempted to release unknown connection

What it means

Guard in ConnectionPool.release(): the released connection's id is absent from the pool's managed set — either it was already released, evicted, or never acquired from this pool. The release is ignored (warn only) to avoid corrupting pool accounting; it usually indicates a double-release or foreign connection object.

Source

Thrown at v3/@claude-flow/shared/src/mcp/connection-pool.ts:239

      // Set timeout
      setTimeout(() => {
        const index = this.waitingClients.indexOf(client);
        if (index !== -1) {
          this.waitingClients.splice(index, 1);
          reject(new Error(`Connection acquire timeout after ${this.config.acquireTimeout}ms`));
        }
      }, this.config.acquireTimeout);
    });
  }

  /**
   * Release a connection back to the pool
   */
  release(connection: PooledConnection): void {
    const managed = this.connections.get(connection.id);
    if (!managed) {
      this.logger.warn('Attempted to release unknown connection', { id: connection.id });
      return;
    }

    // Check for waiting clients first
    const waitingClient = this.waitingClients.shift();
    if (waitingClient) {
      managed.acquire();
      this.stats.totalAcquired++;
      this.emit('pool:connection:acquired', { connectionId: connection.id });
      waitingClient.resolve(managed);
      return;
    }

    // Return to pool
    managed.release();
    this.stats.totalReleased++;

    this.emit('pool:connection:released', { connectionId: connection.id });

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Fix the caller to only release connections it acquired; releasing unknown connections indicates a lifecycle bug.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at v3/@claude-flow/shared/src/mcp/connection-pool.ts:239 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/a0fb2000099693fc. Report an issue: GitHub.