From ee24e7bd8fb3a698b2650ab604a0909fbb5e1f3d Mon Sep 17 00:00:00 2001 From: "Eugenio \"Jay\" Zuccarelli" <11176606+jayzuccarelli@users.noreply.github.com> Date: Thu, 15 Oct 2026 23:26:38 +0000 Subject: [PATCH] fix(anthropic): type tool_result block for is_error lookup Removes the reportUnknownMemberType added by content.get("is_error") on the untyped client payload; same cast-ok pattern as _tool_result_part. Co-Authored-By: Claude Opus 5.5 --- litellm/llms/anthropic/pass_through/adapters/transformation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litellm/llms/anthropic/pass_through/adapters/transformation.py b/litellm/llms/anthropic/pass_through/adapters/transformation.py index de504419d8a..d215657b65d 100644 --- a/litellm/llms/anthropic/pass_through/adapters/transformation.py +++ b/litellm/llms/anthropic/pass_through/adapters/transformation.py @@ -535,7 +535,8 @@ class LiteLLMAnthropicMessagesAdapter: content=self._tool_result_content(content.get("content")), ) self._add_cache_control_if_applicable(content, tool_result, model) - if content.get("is_error") is True and self.target_consumes_tool_error( + tool_result_block = cast(Mapping[str, object], content) # cast-ok: untrusted client payload + if tool_result_block.get("is_error") is True and self.target_consumes_tool_error( model, custom_llm_provider ): tool_result["is_error"] = True