{"record":{"id":"0d1bca1162b34ac7","repo":"Mintplex-Labs/anything-llm","slug":"maximum-rounds-reached","errorCode":null,"errorMessage":"Maximum rounds reached","messagePattern":"Maximum rounds reached","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/utils/agents/aibitat/index.js","lineNumber":1333,"sourceCode":"   * Provide a feedback where it was interrupted if you want to.\n   *\n   * @param feedback The feedback to the interruption if any.\n   * @param attachments Optional attachments (images) to include with the feedback.\n   * @returns\n   */\n  async continue(feedback, attachments = []) {\n    const lastChat = this._chats.at(-1);\n    if (!lastChat || lastChat.state !== \"interrupt\") {\n      throw new Error(\"No chat to continue\");\n    }\n\n    // remove the last chat's that was interrupted\n    this._chats.pop();\n\n    const { from, to } = lastChat;\n\n    if (this.hasReachedMaximumRounds(from, to)) {\n      throw new Error(\"Maximum rounds reached\");\n    }\n\n    if (feedback) {\n      const message = {\n        from,\n        to,\n        content: feedback,\n        ...(attachments?.length > 0 ? { attachments } : {}),\n      };\n\n      // register the message in the chat history\n      this.newMessage(message);\n\n      // ask the node to reply\n      await this.chat({\n        to: message.from,\n        from: message.to,\n      });","sourceCodeStart":1315,"sourceCodeEnd":1351,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/aibitat/index.js#L1315-L1351","documentation":"Thrown by AIbitat.continue() after it pops the last interrupted chat and checks hasReachedMaximumRounds(from, to). hasReachedMaximumRounds returns true when the message history between the two nodes is >= maxRounds (default 100). This is a hard stop to prevent infinite agent-to-agent conversation loops.","triggerScenarios":"Calling continue() on a conversation between two nodes whose history length has reached or exceeded maxRounds (default 100, configurable per AIbitat instance or channel config). Each continue()/chat() between the same from/to pair grows the history.","commonSituations":"Two agents stuck passing a task back and forth without resolution; a complex multi-agent workflow with a low maxRounds override; a long-running session that legitimately needs more rounds than the default budget.","solutions":["Increase maxRounds when constructing the AIbitat instance or channel config if the task legitimately needs more turns.","Inspect the chat history between the two nodes to find why the loop is not converging.","Restructure the agent routing so the task completes in fewer rounds.","Start a new conversation once the limit is hit rather than continuing."],"exampleFix":"// before - default maxRounds (100) too low for the task\nnew AIbitat({ maxRounds: 100 });\n// after - raise the budget for long multi-agent flows\nnew AIbitat({ maxRounds: 250 });","handlingStrategy":"validation","validationCode":"// before calling continue(), check the round budget\nfunction canContinue(aibitat, from, to) {\n  if (aibitat.hasReachedMaximumRounds(from, to))\n    throw new Error(`Round budget exhausted for ${from} <-> ${to}; raise maxRounds or restructure`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await aibitat.continue(feedback);\n} catch (error) {\n  if (error.message === \"Maximum rounds reached\") {\n    // start a new conversation or increase maxRounds\n  } else throw error;\n}","preventionTips":["Size maxRounds to the task complexity when constructing the AIbitat instance.","Monitor chat history length between node pairs in long sessions.","Design agent routing so tasks converge well under the round budget."],"tags":["agent","conversation","limits","aibitat"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}