Errors & Troubleshooting
Docamint validates templates before generating documents. This page explains common errors, why they happen, and how to fix them.
Validation
Missing Field
This error occurs when a tag references a field that does not exist in the payload.
Error: Field "customer.phone" not found
Fix:
- Add customer.phone to your JSON/XML
- Or use a default helper:
{{customer.phone | default("N/A")}}
Loops
Invalid Loop Structure
Happens when {{#each}} is not closed properly.
{{#each items}}
{{this.name}}
Fix:
{{#each items}}
{{this.name}}
{{/each}}
Conditionals
Invalid Conditional
Happens when {{#if}} is missing its closing tag.
{{#if customer.vip}}
VIP Customer!
Fix:
{{#if customer.vip}}
VIP Customer!
{{/if}}
Data
Wrong Data Type
Happens when a helper expects a number or date but receives a string.
{{order.total | currency}}
If order.total is:
"1349.50" <-- string (invalid)
Fix:
1349.50 <-- number (valid)
Escaping
Unescaped Literal Tags
Happens when you want to show tag syntax literally but forget to escape it.
{{customer.name}} <-- Docamint will try to resolve this
Fix:
\{{customer.name}}
XML
XML Node Not Found
Happens when XML nodes are missing or repeated incorrectly.
Error: Node "order.items.item" not found
Fix:
- Ensure XML nodes match your tag structure
- Ensure arrays use repeated nodes (e.g., multiple
<item>tags)
Merge
Merge Errors
Merge errors occur during document generation, usually due to:
- Invalid DOCX structure
- Corrupted template files
- Unsupported Word elements
- Malformed XML payloads
Fix:
- Re-save the DOCX file using Word
- Remove unsupported elements (embedded HTML, broken shapes)
- Validate XML using an online validator
Tips
Best Practices
Follow these guidelines to avoid errors:
- Always validate templates before generating documents
- Use consistent naming in JSON/XML
- Ensure loops and conditionals are properly closed
- Use numbers for numeric fields
- Use ISO format for dates (YYYY-MM-DD)
- Escape literal tags with
\{{ }}