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

Inconsistent Multimodal Image Format: JS CamelCase Vs Python Snake_case

LangGraph JS SDK serializes image content blocks with camelCase keys ('mimeType', 'sourceType'), while the Python LangGraph agent expects snake_case ('mime_type', 'source_type'), causing 400 BadRequestError on image uploads.

highConfidence 96%LangGraphPersistenceCheckpointingConditional Edges

Origin Analysis

The JS SDK and Python SDK use different naming conventions for the same multimodal image schema. The JS SDK fails to convert camelCase field names to the snake_case expected by the Python LangGraph runtime, leading to Pydantic validation errors when Python receives an image block with 'mimeType' instead of 'mime_type' and 'sourceType' instead of 'source_type'.
1. Use Agent Chat UI (JS) to send a multimodal message containing an image to a Python LangGraph agent. 2. Upload an image. 3. Observe the Python agent returns HTTP 400 with error 'Invalid value: image' because the image content block contains `mimeType` and `sourceType` instead of `mime_type` and `source_type`.

Fixing Code Block

Edge Case Audit

This client-side patch only covers the specific call site where the normalization is applied; other code paths may still send camelCase. It should be implemented at the SDK level, not by individual consumers. If the Python SDK is later updated to accept both camelCase and snake_case, double normalization may cause issues; include a feature flag or version check. Rollback recommendation: keep the previous JS SDK version and disable the normalization if the Python agent is updated to expect camelCase or to accept both formats. Test thoroughly with various image types and ensure the data field remains unchanged.

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