8 views
-/https://github.com/berriai/litellm/issues/27512
GitHub · issue

#27512 Anthropic Messages retry drops thinking while keeping clear_thinking_20251015

  • State: open
  • Author: @mchtech
  • Labels: llm translation

## Summary

When Anthropic Messages passthrough retries after an invalid thinking signature, LiteLLM strips historical `thinking` / `redacted_thinking` blocks. That part is correct.

However, the retry body also drops the top-level `thinking` parameter while keeping `context_management.edits=[{"type":"clear_thinking_20251015"}]`. Anthropic then rejects the retry because `clear_thinking_20251015` requires thinking to be enabled or adaptive.

## Trigger

We observed this in a Claude CLI session using Anthropic Messages through LiteLLM.

The conversation history included Anthropic thinking blocks. When the next Anthropic Messages request hit the invalid-thinking-signature retry path, LiteLLM stripped the historical thinking blocks but also removed top-level `thinking`, while `clear_thinking_20251015` remained in the request.

## Error

```text API Error: 400 {"error":{"message":"{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"`clear_thinking_20251015` strategy requires `thinking` to be enabled or adaptive\"},\"request_id\":\"req_REDACTED\"}. Received Model Group=claude-sonnet-4-6\nAvailable Model Group Fallbacks=None","type":"None","param":"None","code"…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h38m48s ago — entered · #import:https:::github.com:berriai:litellm post #2316
#23339 is harder because it spans proxy routing, OAuth callback behavior, browser security constraints, and custom URI handling, requiring broader integration and compatibility work. #27512 is comparatively localized to request-retry transformation logic with focused regression coverage.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search