{"record":{"id":"f401b071810132eb","repo":"BerriAI/litellm","slug":"agentic-loop-plan-missing-patched-messages","errorCode":null,"errorMessage":"Agentic loop plan missing patched messages","messagePattern":"Agentic loop plan missing patched messages","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/litellm_core_utils/chat_completion_agentic_loop.py","lineNumber":131,"sourceCode":"async def _execute_chat_completion_agentic_plan(\n    *,\n    plan: AgenticLoopPlan,\n    callback: CustomLogger,\n    model: str,\n    optional_params: dict[str, object],\n    kwargs: dict[str, object],\n    logging_obj: object,\n    custom_llm_provider: str,\n    depth: int,\n    max_loops: int,\n    fingerprints: list[str],\n    fingerprint: str,\n) -> object:\n    import litellm\n\n    patch: Final = plan.request_patch or AgenticLoopRequestPatch()\n    if patch.messages is None:\n        raise ValueError(\"Agentic loop plan missing patched messages\")\n\n    full_model_name = patch.model or model\n    if \"/\" not in full_model_name:\n        full_model_name = f\"{custom_llm_provider}/{full_model_name}\"\n\n    optional_params_for_followup: Final = {**optional_params, **patch.optional_params}\n    if patch.tools is not None:\n        optional_params_for_followup[\"tools\"] = patch.tools\n    if \"tool_choice\" not in patch.optional_params:\n        optional_params_for_followup.pop(\"tool_choice\", None)\n\n    kwargs_for_followup: Final = _filter_followup_kwargs(kwargs)\n    kwargs_for_followup.update(\n        {k: v for k, v in _filter_followup_kwargs(patch.kwargs).items() if k not in optional_params_for_followup}\n    )\n    kwargs_for_followup[\"_agentic_loop_depth\"] = depth + 1\n    kwargs_for_followup[\"max_agentic_loops\"] = max_loops\n    kwargs_for_followup[\"_agentic_loop_fingerprints\"] = fingerprints + [fingerprint]","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/chat_completion_agentic_loop.py#L113-L149","documentation":"Error \"Agentic loop plan missing patched messages\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/litellm_core_utils/chat_completion_agentic_loop.py:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Internal agentic loop state error; retry the request or report with the plan payload."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}