opendataloader-project/opendataloader-pdf · error · IOException
pdf2img PAGE_PNG_DATA is empty
Error message
pdf2img PAGE_PNG_DATA is empty
What it means
The nested RESULT object exists but PAGE_PNG_DATA is missing or an empty string, so there is no image payload to decode. fetchPageImage checks this before attempting Base64 decode. Per-page IOException, caught and logged by table/figure handlers.
Source
Thrown at java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/hybrid/HancomAIClient.java:712
}
JsonNode root = objectMapper.readTree(respBody.string());
// Navigate: RESULT[0].RESULT.PAGE_PNG_DATA
JsonNode resultArr = root.get("RESULT");
if (resultArr == null || !resultArr.isArray() || resultArr.size() == 0) {
throw new IOException("pdf2img RESULT is empty");
}
JsonNode pageResult = resultArr.get(0);
JsonNode innerResult = pageResult.get("RESULT");
if (innerResult == null) {
throw new IOException("pdf2img inner RESULT is null");
}
String pngBase64 = innerResult.has("PAGE_PNG_DATA")
? innerResult.get("PAGE_PNG_DATA").asText() : null;
if (pngBase64 == null || pngBase64.isEmpty()) {
throw new IOException("pdf2img PAGE_PNG_DATA is empty");
}
byte[] pngBytes;
try {
pngBytes = Base64.getDecoder().decode(pngBase64);
} catch (IllegalArgumentException e) {
// fetchPageImage is declared to throw IOException and callers catch
// only IOException. Escaping IAE would abort the whole conversion
// instead of skipping the failed page.
throw new IOException("pdf2img PAGE_PNG_DATA is not valid Base64", e);
}
BufferedImage image = ImageIO.read(new ByteArrayInputStream(pngBytes));
if (image == null) {
throw new IOException("pdf2img PAGE_PNG_DATA is not a readable image");
}
if (cropOutput.active()) {
savePageImageFile(cropOutput.directory(), pageIndex, pngBytes);
}View on GitHub (pinned to a7789b8e77)
Solutions
- Check backend pdf2img logs for PNG encoding/storage errors on the page
- Confirm the field name PAGE_PNG_DATA matches this backend version
- Retry the page; if persistent, accept the per-page skip
- Ensure the backend has disk/memory for page image encoding
Defensive patterns
Strategy: try-catch
Try / catch
try {
return cache.getOrFetch(pageNum, idx -> client.fetchPageImage(pdf, idx, crop));
} catch (IOException e) {
if (e.getMessage().contains("PAGE_PNG_DATA is empty")) {
log.warn("page {} rendered but PNG payload missing", pageNum);
}
continue;
} Prevention
- Ensure the backend has disk/memory to encode page PNGs
- Confirm the PAGE_PNG_DATA field name matches this backend version
- Accept per-page skips for degraded output
When it happens
Trigger: innerResult.has("PAGE_PNG_DATA") is false, or innerResult.get("PAGE_PNG_DATA").asText() is null or empty, inside fetchPageImage.
Common situations: Backend rendered the page but failed to encode/attach the PNG (disk full, encoder error); backend returned a placeholder entry without image data; backend version returning a renamed field.
Related errors
- pdf2img returned empty body
- pdf2img RESULT is empty
- pdf2img inner RESULT is null
- pdf2img PAGE_PNG_DATA is not valid Base64
- pdf2img returned HTTP %s
AI-assisted analysis of opendataloader-project/opendataloader-pdf@a7789b8e77 (2026-08-14).
Data as JSON: /api/errors/85e099e1b86c68d7.
Report an issue: GitHub.