BerriAI/litellm · error · ValueError
Agentic loop detected repeated tool-call fingerprint; aborti
Error message
Agentic loop detected repeated tool-call fingerprint; aborting rerun
What it means
Error "Agentic loop detected repeated tool-call fingerprint; aborting rerun" thrown in BerriAI/litellm.
Source
Thrown at litellm/litellm_core_utils/chat_completion_agentic_loop.py:77
def _fingerprint_tools(tool_calls: object) -> str:
try:
return json.dumps(tool_calls, sort_keys=True, default=str)
except Exception:
return str(tool_calls)
def _check_agentic_loop_safety(
tool_calls: object,
fingerprints: list[str],
depth: int,
max_loops: int,
model: str,
) -> str:
fingerprint: Final = _fingerprint_tools(tool_calls)
if fingerprint in fingerprints:
raise ValueError("Agentic loop detected repeated tool-call fingerprint; aborting rerun")
if depth >= max_loops:
raise ValueError(f"Exceeded max_agentic_loops={max_loops} for model={model}")
return fingerprint
def _wrap_response_as_fake_stream(response: object) -> object:
if getattr(response, "object", None) == "chat.completion.chunk":
return response
if not hasattr(response, "choices"):
return response
from litellm.llms.base_llm.base_model_iterator import (
convert_model_response_to_streaming,
)
return convert_model_response_to_streaming(cast(ModelResponse, response))
def _add_agentic_loop_metadata(kwargs_for_followup: dict[str, object]) -> None:View on GitHub (pinned to 6c2dcb801b)
Solutions
- The agentic loop is repeating identical tool calls; fix the tool or prompt so the loop converges, or raise max_agentic_loops.
When it happens
Trigger: Thrown at litellm/litellm_core_utils/chat_completion_agentic_loop.py:77 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/5e816cf300fbb69a.
Report an issue: GitHub.