opendataloader-project/opendataloader-pdf · error · IOException
pdf2img inner RESULT is null
Error message
pdf2img inner RESULT is null
What it means
RESULT[0] exists but its inner RESULT field (expected to hold PAGE_PNG_DATA) is null. This means the pdf2img envelope shape is unexpected — the backend returned a RESULT array whose first element lacks the nested RESULT object. 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:706
throw new IOException("pdf2img returned HTTP " + response.code());
}
ResponseBody respBody = response.body();
if (respBody == null) {
throw new IOException("pdf2img returned empty body");
}
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));View on GitHub (pinned to a7789b8e77)
Solutions
- Inspect the raw RESULT[0] payload to see why the nested RESULT is absent
- Check backend pdf2img version matches the expected envelope
- Retry the page; if persistent, accept the per-page skip
- Review backend logs for the PAGE_INDEX that produced the malformed entry
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("inner RESULT is null")) {
log.warn("page {} pdf2img envelope malformed (no nested RESULT)", pageNum);
}
continue;
} Prevention
- Pin the backend pdf2img version that produces the expected RESULT[0].RESULT nesting
- Capture raw responses when envelope errors cluster on specific pages
- Accept per-page skips rather than aborting the whole conversion
When it happens
Trigger: resultArr.get(0) is present but pageResult.get("RESULT") returns null inside fetchPageImage.
Common situations: Backend pdf2img returned an error/wrapper object in RESULT[0] without the nested RESULT (e.g. an error envelope); version skew altering the nesting; backend returning metadata-only entries.
Related errors
- pdf2img returned empty body
- pdf2img RESULT is empty
- pdf2img PAGE_PNG_DATA is empty
- pdf2img PAGE_PNG_DATA is not valid Base64
- Invalid response: missing 'document' field
AI-assisted analysis of opendataloader-project/opendataloader-pdf@a7789b8e77 (2026-08-14).
Data as JSON: /api/errors/7136851fcae18bd7.
Report an issue: GitHub.