PDF generation failures
When the Quotation / Invoice / Booking PDF won't render.
3 min readLast updated 13 Apr 2026
PDF rendering uses WeasyPrint server-side. Most failures fall into a small set of categories — this article covers them.
Common error messages
"PDF generation failed (500)"
The server raised an unhandled exception while rendering. Causes:
- Missing template content — your tenant's PDF template has been corrupted or a referenced block doesn't exist. Open Settings → PDF Designer for the relevant doc type and confirm the layout looks right. Re-publishing it usually fixes corruption.
- Bad logo URL — your tenant's
logo_urlpoints to a 404 or a server WeasyPrint can't reach. Re-upload from Settings → Tenant → Branding. - Bad font reference — rare; only happens when a custom font CSS rule references a missing file.
"PDF generation timed out"
Document took longer than the server limit (~10 s). Causes:
- Very large invoice — 200+ line items with embedded images. Split it.
- Slow image fetch — your logo or screenshot URL is on a slow CDN. Move assets to a faster host or upload directly to
/api/uploads/.
"Cannot read properties of undefined (reading '...')"
A JS error from the frontend, not the PDF renderer. Means the data you tried to render is missing a field the template expects. Common cases:
- Quotation without a customer — backend allows it; PDF doesn't. Fill in a customer.
- Invoice without a due date — set one before generating.
- Booking with no charges — add at least one charge line.
Step-by-step diagnosis
- Read the exact error message — most messages are diagnostic.
- Check whether other documents render fine (e.g. can you open another invoice's PDF?). If yes, the issue is data-specific to this one record.
- Check whether the same doc type fails for every tenant user (could be a template issue) or just this user (could be a permission issue).
- Try the Designer preview — Settings → PDF Designer → pick the doc type. The preview renders the template with sample data. If the preview works but a real document doesn't, the issue is record-specific.
- For a "missing field" error, open the record's edit form and look for required fields that are blank.
Common pitfalls
Regulatory documents (MAWB / HAWB / MBL / HBL / Consol Manifest / CMR)
These render via the regulated-forms pipeline, not the block engine. They're not user-editable. If they fail:
- Confirm the underlying booking has the required fields (vessel name, port codes, container numbers).
- Re-trigger by clicking Print again — most regulated-form failures are transient.
- If persistent, contact support — these renderers don't have a "fall back to defaults" path.
When to contact support
- A document that worked yesterday fails today, and no template change happened.
- The same error message appears across multiple unrelated documents.
- WeasyPrint OOM (out-of-memory) errors — these are platform-side issues we need to scale.
Email [email protected] with the document type, record ID, and exact error.
Was this article helpful?