You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extracting Markdown code blocks can fail even when the model returns valid fenced JSON. FormatHandler treats triple backticks inside a JSON string as output delimiters. Its own format_extraction_example() output therefore cannot be parsed back with the default settings when an extraction contains a Markdown code block.
Expected behavior
The single outer JSON block should parse, preserving backticks inside JSON string values.
Actual behavior
The reproduction raises FormatParseError: Multiple fenced blocks found. Expected exactly one. There is only one outer output block; the other backticks belong to the extraction value.
As a control, using FormatHandler(use_fences=False) for both formatting and parsing preserves the same value successfully.
Any additional content
Reproduced on main 3a68580f0aede0e96a2e1e03daa2a5f4011e4fcd, Python 3.11.17, macOS, with no model/API calls. The fence regex matches delimiters inside the JSON string before JSON parsing runs. This concerns fenced output containing literal backticks; #414 / #444 concern receiving an outer fenced block when raw JSON mode was requested.
Activity
mohmedmm commentedon Nov 2, 2026
opened #604 with a fix anchoring code fence delimiters.