{"record":{"id":"9c4724c242955b4e","repo":"ruvnet/ruflo","slug":"32603-9c4724","errorCode":"-32603","errorMessage":"Internal error","messagePattern":"Internal error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"v3/@claude-flow/mcp/src/transport/http.ts","lineNumber":334,"sourceCode":"        transport: 'http',\n        capabilities: {\n          jsonrpc: true,\n          websocket: true,\n        },\n      });\n    });\n\n    this.app.use((req, res) => {\n      res.status(404).json({\n        error: 'Not found',\n        path: req.path,\n      });\n    });\n\n    this.app.use((err: Error, req: Request, res: Response, next: NextFunction) => {\n      this.logger.error('Express error', { error: err });\n      this.errors++;\n      res.status(500).json({\n        jsonrpc: '2.0',\n        id: null,\n        error: { code: -32603, message: 'Internal error' },\n      });\n    });\n  }\n\n  private setupWebSocketHandlers(): void {\n    if (!this.wss) return;\n\n    // SECURITY: Handle WebSocket authentication via upgrade request\n    this.wss.on('connection', (ws, req) => {\n      // Validate authentication if enabled\n      if (this.config.auth?.enabled) {\n        const url = new URL(req.url || '', `http://${req.headers.host}`);\n        const token = url.searchParams.get('token') || req.headers['authorization']?.replace(/^Bearer\\s+/i, '');\n\n        if (!token) {","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/mcp/src/transport/http.ts#L316-L352","documentation":"Express error-handling middleware caught an unhandled exception from any route handler; the server logs it, increments its error counter, and returns a sanitized JSON-RPC -32603 without internal detail. It is the transport's last-resort wrapper — the real cause is in the logged 'Express error' entry.","triggerScenarios":"Thrown at v3/@claude-flow/mcp/src/transport/http.ts:334 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check server logs for the underlying exception and fix the root cause.","Add structured error handling around the handler so failures return a descriptive error instead of a generic 500."],"exampleFix":null,"handlingStrategy":"try-catch","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-14T05:17:10.506Z"}