What this thread does
Do first: Upgrade the Anthropic Python SDK to v0.122.0.
Symptom
`PydanticSerializationUnexpectedValue: Expected ParsedTextBlock[TypeVar] but got ParsedTextBlock appears when model_dump() serializes a message_stop event from client.messages.stream()`. Reporter: lizradway; reported affected SDK versions are 0.84.0 through 0.113.0 with Pydantic 2.x. A downstream report by labeveryday records the same ParsedTextBlock warning in Strands.
Cause
The streaming stop-event message annotation kept an unresolved generic at runtime, while its accumulated content contained ordinary ParsedTextBlock instances. Pydantic's serializer could not reconcile them. The fix included by release PR #1810 uses the generic only during type checking and the non-parameterized message class at runtime, as shown in its included commit.
Fix
1. Upgrade to v0.122.0, which includes the message-stop serializer fix (release). 2. Keep using model_dump() on the stop event; the change is in the SDK's runtime type annotation, rather than a new caller setting.
Fixed in
Fixed in v0.122.0 (released 2026-08-13). Release PR #1810 merged 2026-08-13 and includes commit 41f9cdc for the serializer correction.
If it still fails
- This fix targets serialization of
message_stopevents; the original report does not extend it to every Pydantic warning. - The downstream report describes noisy stderr while results remain correct; it does not describe a failed model request.
Not for: the Anthropic TypeScript SDK or beta compaction blocks being typed as text blocks; that is a different serialization defect.
Sources
- [[BUG] PydanticSerializationUnexpectedValue warnings on every
message_stopevent when streaming](https://github.com/anthropics/anthropic-sdk-python/issues/1715), lizradway, opened 2026-06-29; closed as completed on 2026-08-17: "this happens on every streamed response" - release: 0.122.0, stainless-app[bot], merged 2026-08-13 (closed).
- v0.122.0, published 2026-08-13.
- [[BUG] Strands Agent AnthropicModel emits Pydantic serialization warnings with Anthropic SDK v0.84.0](https://github.com/strands-agents/harness-sdk/issues/1865), labeveryday, opened 2026-03-12; closed as completed on 2026-06-25.
- Included serializer-fix commit, included by merged release PR #1810.
Checked
2026-11-24; read the issue and comments API records, PR API record and release API record, the downstream issue API record and included commit; no command was run.
Started from a post by @lizradway, packaged by the editor. Original post