{"record":{"id":"24f795f647ae6fb8","repo":"ruvnet/ruflo","slug":"mcp-exceeded-tool-followup-loops-falling-back","errorCode":null,"errorMessage":"[mcp] exceeded tool-followup loops; falling back","messagePattern":"\\[mcp\\] exceeded tool-followup loops; falling back","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ruflo/src/ruvocal/src/lib/server/textGeneration/mcp/runMcpFlow.ts","lineNumber":811,"sourceCode":"\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!streamedContent && lastAssistantContent.trim().length > 0) {\n\t\t\t\tyield { type: MessageUpdateType.Stream, token: lastAssistantContent };\n\t\t\t}\n\t\t\tyield {\n\t\t\t\ttype: MessageUpdateType.FinalAnswer,\n\t\t\t\ttext: lastAssistantContent,\n\t\t\t\tinterrupted: false,\n\t\t\t};\n\t\t\tlogger.info(\n\t\t\t\t{ length: lastAssistantContent.length, loop },\n\t\t\t\t\"[mcp] final answer emitted (no tool_calls)\"\n\t\t\t);\n\t\t\treturn \"completed\";\n\t\t}\n\t\tlogger.warn({}, \"[mcp] exceeded tool-followup loops; falling back\");\n\t} catch (err) {\n\t\tconst msg = String(err ?? \"\");\n\t\tconst isAbort =\n\t\t\t(abortSignal && abortSignal.aborted) ||\n\t\t\tmsg.includes(\"AbortError\") ||\n\t\t\tmsg.includes(\"APIUserAbortError\") ||\n\t\t\tmsg.includes(\"Request was aborted\");\n\t\tif (isAbort) {\n\t\t\t// Expected on user stop; keep logs quiet and do not treat as error\n\t\t\tlogger.debug({}, \"[mcp] aborted by user\");\n\t\t\treturn \"aborted\";\n\t\t}\n\t\tlogger.warn({ err: msg }, \"[mcp] flow failed, falling back to default endpoint\");\n\t} finally {\n\t\t// ensure MCP clients are closed after the turn\n\t\tawait drainPool();\n\t}\n","sourceCodeStart":793,"sourceCodeEnd":829,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/ruflo/src/ruvocal/src/lib/server/textGeneration/mcp/runMcpFlow.ts#L793-L829","documentation":"Log warning in runMcpFlow: the tool-call/answer loop hit its maximum follow-up iterations without a final tool-free answer, so the flow gives up on further tool round-trips and falls back to the default endpoint.","triggerScenarios":"Thrown at ruflo/src/ruvocal/src/lib/server/textGeneration/mcp/runMcpFlow.ts:811 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the number of tool-followup rounds the model requests (prompt/tooling issue), or raise the configured loop limit if the workflow legitimately needs more iterations."],"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-14T00:17:10.932Z"}