AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Core: Content_blocks Raises TypeError On A V0 Multimodal Block That Carries An Id

Reading content_blocks on a legacy v0 multimodal block with an id raises TypeError due to duplicate id keyword argument in _convert_legacy_v0_content_block_to_v1.

highConfidence 95%LangChainChat ModelsMemoryAffected V1.6.3

Origin Analysis

In langchain_core/messages/block_translators/langchain_v0.py, _convert_legacy_v0_content_block_to_v1 builds extras from keys not in known_keys. For url, base64, and text source types, known_keys omits 'id', causing 'id' to remain in extras and be passed both explicitly and via **extras, leading to TypeError.
Using langchain-core 1.6.3, create a HumanMessage with content=[{"type": "image", "source_type": "url", "url": "https://example.com/image.png", "id": "block-1"}] and access message.content_blocks. This raises TypeError: got multiple values for keyword argument 'id'.

Fixing Code Block

Edge Case Audit

This fix is backward compatible and only affects previously failing code paths. No impact on concurrency or threading. Rollback: if unexpected issues arise, reverting to previous version will restore original behavior (including the bug). Ensure tests cover all seven branches to avoid regression.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state