{"record":{"id":"2a73d80ac6a98457","repo":"BerriAI/litellm","slug":"websearchinterception-missing-follow-up-messages","errorCode":null,"errorMessage":"WebSearchInterception: missing follow-up messages","messagePattern":"WebSearchInterception: missing follow-up messages","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/websearch_interception/handler.py","lineNumber":1188,"sourceCode":"        tool_calls: list[dict],\n        thinking_blocks: list[dict],\n        anthropic_messages_optional_request_params: dict,\n        logging_obj: \"LiteLLMLoggingObj | None\",\n        stream: bool,\n        kwargs: dict,\n    ) -> \"AnthropicMessagesResponse | AsyncIterator[object]\":\n        \"\"\"Legacy path: execute search + build patch + run follow-up call.\"\"\"\n        request_patch, structured_results = await self._build_anthropic_request_patch(\n            model=model,\n            messages=messages,\n            tool_calls=tool_calls,\n            thinking_blocks=thinking_blocks,\n            anthropic_messages_optional_request_params=anthropic_messages_optional_request_params,\n            logging_obj=logging_obj,\n            kwargs=kwargs,\n        )\n        if request_patch.messages is None:\n            raise ValueError(\"WebSearchInterception: missing follow-up messages\")\n\n        optional_params: Final = dict(anthropic_messages_optional_request_params)\n        optional_params.update(request_patch.optional_params)\n        max_tokens = request_patch.max_tokens\n        if max_tokens is None:\n            max_tokens = cast(int | None, optional_params.pop(\"max_tokens\", None))\n        else:\n            optional_params.pop(\"max_tokens\", None)\n        if max_tokens is None:\n            max_tokens = cast(int, kwargs.get(\"max_tokens\", 1024))\n\n        response: AnthropicMessagesResponse | AsyncIterator[object] = await anthropic_messages.acreate(\n            max_tokens=max_tokens,\n            messages=request_patch.messages,\n            model=request_patch.model or model,\n            **optional_params,\n            **request_patch.kwargs,\n        )","sourceCodeStart":1170,"sourceCodeEnd":1206,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/websearch_interception/handler.py#L1170-L1206","documentation":"The legacy websearch-interception follow-up path reached its completion call without the follow-up messages it needs to continue the conversation after executing searches — an internal invariant break in request assembly, not a user input error.","triggerScenarios":"The web search interception handler receives a request lacking follow-up messages.","commonSituations":"Upstream client sending a search-only payload without conversation messages.","solutions":["Ensure the web-search response is followed by a request containing follow-up messages so the interception handler can continue."],"exampleFix":"# include the original messages array in the intercepted request payload","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}