kmail.at
← learning

langchain · difficulty ◆◆

fix(core): Output Parser Bugs in xml.py and pydantic.py

Opaque parse failures now tell you exactly what broke

Your chains crashed on parse errors that gave you zero debugging signal.

2026-07-10 · 6 min read

$ pip install -U langchain-core langchain-openai

What it does

langchain-core 1.4.9 fixes two output-parser bugs. The XML parser mishandled continuation lines with colons inside tags, and the Pydantic path raised bare ValueError calls with no explanatory message. The fix adds context-rich errors and corrects the XML edge case.

Why it matters

Output parsers sit between LLM text and structured Python objects. Bugs silently corrupt data or crash chains with uninformative tracebacks. The Pydantic fix alone saves you from ValueErrors with no clue which field failed or why.

Example

$ Parse a movie review with PydanticOutputParser and handle the error path.
Title:  Inception
Rating: 8.7/10
Summary: A mind-bending sci-fi thriller about dream infiltration.

On invalid input you now get a helpful message instead of a bare ValueError.

Common flags

PydanticOutputParser
Parse LLM output into a Pydantic v1 model
XMLOutputParser
Parse LLM output as XML tags into a dict
JsonOutputParser
Parse LLM output as JSON into a dict or Pydantic model
RetryOutputParser
Wrap any parser with automatic retry on parse failure

History

Origin

The core output parsing layer had two latent bugs affecting edge-case LLM responses.

The fix

The 1.4.9 patch added context-rich messages to bare raise ValueError calls and corrected XML continuation-line parsing.

Fun facts

Pros & cons

pros

  • + Context-rich error messages
  • + Fixed XML colon edge case
  • + Easy to verify with a try/except

cons

  • − Overlaps with the 07-09 entry
  • − Core-level fix, no new API

Takeaways

  1. 1Upgrade for better parse errors
  2. 2Test the XML colon edge case
  3. 3Log parse failures for visibility

Related commands

← all learning