{"record":{"id":"7a96561bea4bcb2e","repo":"ruvnet/ruflo","slug":"1013-7a9656","errorCode":"1013","errorMessage":"Server at capacity","messagePattern":"Server at capacity","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/mcp/transport/websocket.ts","lineNumber":288,"sourceCode":"    try {\n      client.ws.close(1000, reason);\n      return true;\n    } catch {\n      return false;\n    }\n  }\n\n  /**\n   * Setup WebSocket handlers\n   */\n  private setupWebSocketHandlers(): void {\n    if (!this.wss) return;\n\n    this.wss.on('connection', (ws, req) => {\n      // Check max connections\n      if (this.config.maxConnections && this.clients.size >= this.config.maxConnections) {\n        this.logger.warn('Max connections reached, rejecting client');\n        ws.close(1013, 'Server at capacity');\n        return;\n      }\n\n      const clientId = `client-${++this.connectionCounter}`;\n      const client: ClientConnection = {\n        id: clientId,\n        ws,\n        createdAt: new Date(),\n        lastActivity: new Date(),\n        messageCount: 0,\n        isAlive: true,\n        isAuthenticated: !this.config.auth?.enabled,\n      };\n\n      this.clients.set(clientId, client);\n      this.totalConnections++;\n\n      this.logger.info('Client connected', {","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/mcp/transport/websocket.ts#L270-L306","documentation":"setupWebSocketHandlers()'s connection callback found the live client count already at config.maxConnections, so the new socket is immediately closed with code 1013 ('try again later') instead of being admitted. This is capacity shedding, not a crash: clients should wait and reconnect when a slot frees.","triggerScenarios":"New WebSocket connection arrives while the server is at its configured max-connections cap; connection is refused to protect memory/FD headroom.","commonSituations":"See trigger scenarios.","solutions":["Increase maxConnections if the limit is too low for expected load.","Ensure disconnected clients are reaped so slots are freed (check heartbeat/cleanup logic).","Have clients implement retry-with-backoff when the server reports capacity."],"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"}