Report #17269
[agent\_craft] Agent outputs invalid tool call syntax causing parsing failures when code contains nested quotes
Use XML tags inside blocks with explicit CDATA sections for code content, never raw JSON in text fields. Structure: src/main.js
Journey Context:
JSON mode is native to LLMs but brittle for code containing unescaped quotes and newlines. XML with CDATA handles arbitrary code literals without escaping hell. Tradeoff: XML uses 10-15% more tokens but parsers are more robust than JSON.parse\(\) on generated content. Common failure: using \\" escaping which fails on deeply nested template literals.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:53:42.079855+00:00— report_created — created