{"record":{"id":"326d03265be6dd55","repo":"ruvnet/ruflo","slug":"mcp-failed-to-connect-client","errorCode":null,"errorMessage":"[mcp] failed to connect client","messagePattern":"\\[mcp\\] failed to connect client","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ruflo/src/ruvocal/src/lib/server/textGeneration/mcp/toolInvocation.ts","lineNumber":142,"sourceCode":"\t\t\t\teta: 10,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Preload clients per distinct server used in this batch\n\tconst distinctServerNames = Array.from(\n\t\tnew Set(prepared.map((p) => mapping[p.call.name]?.server).filter(Boolean) as string[])\n\t);\n\tconst clientMap = new Map<string, Client>();\n\tawait Promise.all(\n\t\tdistinctServerNames.map(async (name) => {\n\t\t\tconst cfg = serverLookup.get(name);\n\t\t\tif (!cfg) return;\n\t\t\ttry {\n\t\t\t\tconst client = await getClient(cfg, abortSignal);\n\t\t\t\tclientMap.set(name, client);\n\t\t\t} catch (e) {\n\t\t\t\tlogger.warn({ server: name, err: String(e) }, \"[mcp] failed to connect client\");\n\t\t\t}\n\t\t})\n\t);\n\n\t// Async queue to stream results in finish order\n\tfunction createQueue<T>() {\n\t\tconst items: T[] = [];\n\t\tconst waiters: Array<(v: IteratorResult<T>) => void> = [];\n\t\tlet closed = false;\n\t\treturn {\n\t\t\tpush(item: T) {\n\t\t\t\tconst waiter = waiters.shift();\n\t\t\t\tif (waiter) waiter({ value: item, done: false });\n\t\t\t\telse items.push(item);\n\t\t\t},\n\t\t\tclose() {\n\t\t\t\tclosed = true;\n\t\t\t\tlet waiter: ((v: IteratorResult<T>) => void) | undefined;","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/ruflo/src/ruvocal/src/lib/server/textGeneration/mcp/toolInvocation.ts#L124-L160","documentation":"Log warning in executeToolCalls: connecting an MCP Client to a server needed by the batch's tool calls failed; that server (and its tools) is skipped while other servers in the batch still execute.","triggerScenarios":"Thrown at ruflo/src/ruvocal/src/lib/server/textGeneration/mcp/toolInvocation.ts:142 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the MCP server URL/command, credentials, and network reachability; ensure the server process is running and the client transport (SSE/HTTP/stdio) matches the server."],"exampleFix":null,"handlingStrategy":"fallback","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"}