Common Failure Scenarios
Report generation can fail in four major ways:
- Velocity macro errors (null pointer exceptions, missing variables, undefined macros)
- Query timeout errors (large datasets, complex Lucene queries, nested loops)
- PDF export failures (PhantomJS errors, CSS rendering issues, memory limits)
- Missing data dependencies (broken links, missing work items, null custom fields)
Diagnostic Flowchart
Velocity Macro Errors
Symptom
Report page shows error message: Error rendering macro: null pointer exception or Unknown macro: nxKpiCard.
Diagnostic Steps
-
Check browser console (F12 → Console tab):
Velocity error at line 42: $hazard.customFields.asil is null
-
Inspect page source (right-click → View Page Source):
- Search for
#parse("/polarion/nextedy_solutions.vm")
- Verify macro library import appears before macro usage
-
Verify macro exists in
.polarion/pages/includes/nextedy_solutions.vm:
- Check spelling:
nxKpiCard not nxKPICard
- Verify macro version matches solution version (v6.0+)
Common Fixes
Null pointer on custom field:
## BAD: crashes if asil is null
$hazard.customFields.asil.id
## GOOD: safe navigation with default
#if($hazard.customFields.asil)
$hazard.customFields.asil.id
#else
N/A
#end
Undefined macro:
## Add to top of report page.xml
#parse("/polarion/nextedy_solutions.vm")
Missing variable:
## Initialize variables before loop
#set($totalHazards = 0)
#set($asilDCount = 0)
#foreach($hazard in $page.getContext().getTracker().queryWorkItems("type:hazard", null))
#set($totalHazards = $totalHazards + 1)
#if($hazard.customFields.asil.id == "asilD")
#set($asilDCount = $asilDCount + 1)
#end
#end
If you see Unknown macro errors after upgrading TestAuto2, the nextedy_solutions.vm library may be outdated. Re-import the macro library from the solution installer ZIP: .polarion/pages/includes/nextedy_solutions.vm
Query Timeout Errors
Symptom
Report page loads indefinitely or shows: Query timeout after 30 seconds.
Diagnostic Steps
-
Identify slow query in browser console:
Lucene query timed out: type:failureMode AND linkedWorkItems:*
-
Check query complexity:
- Nested loops querying work items inside loops
linkedWorkItems:* queries without field filter
- Cross-project queries (
project.id:)
-
Review work item count:
- FMEA reports with >500 failure modes
- Traceability reports spanning >1000 requirements
Optimization Strategies
Use field filters instead of wildcard:
## BAD: queries all linked work items (slow)
#set($fmeas = $tracker.queryWorkItems("type:failureMode AND linkedWorkItems:*", null))
## GOOD: queries specific link role (fast)
#set($fmeas = $tracker.queryWorkItems("type:failureMode AND linkedWorkItems.mitigates:$req.id", null))
Cache query results outside loops:
## BAD: queries inside loop (N queries)
#foreach($req in $requirements)
#set($tests = $tracker.queryWorkItems("type:testCase AND linkedWorkItems.verifies:$req.id", null))
#end
## GOOD: single query, then filter in memory
#set($allTests = $tracker.queryWorkItems("type:testCase", null))
#foreach($req in $requirements)
#set($reqTests = [])
#foreach($test in $allTests)
#if($test.getLinkedWorkItems("verifies").contains($req))
#set($_ = $reqTests.add($test))
#end
#end
#end
Add pagination for large datasets:
## Limit query size with sorting
#set($queryConfig = $page.getContext().createConfiguration())
#set($_ = $queryConfig.setSort("id", true))
#set($_ = $queryConfig.setLimit(100))
#set($fmeas = $tracker.queryWorkItems("type:failureMode", $queryConfig))
For projects with >1000 failure modes, increase the Polarion report rendering timeout: Administration → System → Advanced Properties → com.polarion.portal.page.timeout = 60 (seconds)
PDF Export Failures
Symptom
PDF export button generates corrupt file, blank PDF, or browser error: PhantomJS rendering failed.
Diagnostic Steps
-
Check PDF export service (Administration → PDF Export):
- Verify PhantomJS is running
- Check export queue for errors
-
Test simplified export:
- Remove all charts/diagrams temporarily
- Export single-page section
- If successful, add sections back incrementally
-
Inspect CSS errors in browser console:
- Invalid color codes (e.g.,
color: #gggggg)
- Missing fonts referenced in
@font-face
- Page breaks inside tables (
page-break-inside: avoid)
Common Fixes
Fix CSS color codes:
/* BAD: invalid hex code */
.asil-d { background-color: #rr0000; }
/* GOOD: valid hex */
.asil-d { background-color: #cc0000; }
Split large tables for PDF:
## Add page breaks every 50 rows
#foreach($fm in $failureModes)
<tr>...</tr>
#if($foreach.index > 0 && $foreach.index % 50 == 0)
</table>
<div style="page-break-after: always;"></div>
<table>
#end
#end
Reduce image resolution:
<!-- BAD: 4K chart crashes PhantomJS -->
<img src="chart.png" width="3840" height="2160">
<!-- GOOD: web-optimized resolution -->
<img src="chart.png" width="800" height="600">
PDF exports larger than 200 pages may exceed PhantomJS heap memory (default 512MB). Split large reports into multiple documents or increase heap via Administration → PDF Export → Advanced Settings → -Xmx1024m
Missing Data Dependencies
Symptom
Report shows blank sections, N/A values everywhere, or error: Cannot read property 'id' of null.
Diagnostic Steps
-
Verify work items exist:
- Navigate to Work Items → All Items
- Run Lucene query manually:
type:hazard AND module.id:HAZID
- Check if query returns expected count
-
Check link role integrity:
- Open work item form (e.g., Hazard)
- Verify linked Safety Goals appear in form
- Confirm link role name matches report query (e.g.,
derivedFrom not derives)
-
Validate custom fields:
- Administration → Work Items → Custom Fields
- Verify field IDs match Velocity references (case-sensitive)
- Check if enum values exist (e.g.,
asilD in ASIL enum)
Common Fixes
Check for null before accessing:
## BAD: crashes if safetyGoal link is empty
Safety Goal: $hazard.getLinkedWorkItems("derivedFrom").get(0).title
## GOOD: safe access with fallback
#set($goals = $hazard.getLinkedWorkItems("derivedFrom"))
#if($goals.size() > 0)
Safety Goal: $goals.get(0).title
#else
Safety Goal: Not assigned
#end
Verify module filter:
## Ensure module field is populated
#set($haraHazards = $tracker.queryWorkItems("type:hazard AND module.id:HAZID", null))
#if($haraHazards.size() == 0)
<p class="warning">⚠️ No hazards found in HAZID module. Check module assignment.</p>
#end
Add debug output to reports during development: <pre>$hazard.dump()</pre> shows all available fields and methods for a work item object.
Verification
You should now see:
- ✅ Report page loads within 10 seconds without errors
- ✅ All sections populated with live data (no
N/A or blank areas)
- ✅ PDF export completes successfully (Download PDF button works)
- ✅ Browser console shows no Velocity or JavaScript errors
- ✅ Traceability coverage percentages match manual counts
See Also