{"record":{"id":"413c53aa4738ca1f","repo":"opendataloader-project/opendataloader-pdf","slug":"pdf2img-result-is-empty","errorCode":null,"errorMessage":"pdf2img RESULT is empty","messagePattern":"pdf2img RESULT is empty","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/hybrid/HancomAIClient.java","lineNumber":700,"sourceCode":"            .url(baseUrl + PDF2IMG_ENDPOINT)\n            .post(body)\n            .build();\n\n        try (Response response = httpClient.newCall(httpRequest).execute()) {\n            if (!response.isSuccessful()) {\n                throw new IOException(\"pdf2img returned HTTP \" + response.code());\n            }\n\n            ResponseBody respBody = response.body();\n            if (respBody == null) {\n                throw new IOException(\"pdf2img returned empty body\");\n            }\n\n            JsonNode root = objectMapper.readTree(respBody.string());\n            // Navigate: RESULT[0].RESULT.PAGE_PNG_DATA\n            JsonNode resultArr = root.get(\"RESULT\");\n            if (resultArr == null || !resultArr.isArray() || resultArr.size() == 0) {\n                throw new IOException(\"pdf2img RESULT is empty\");\n            }\n\n            JsonNode pageResult = resultArr.get(0);\n            JsonNode innerResult = pageResult.get(\"RESULT\");\n            if (innerResult == null) {\n                throw new IOException(\"pdf2img inner RESULT is null\");\n            }\n\n            String pngBase64 = innerResult.has(\"PAGE_PNG_DATA\")\n                ? innerResult.get(\"PAGE_PNG_DATA\").asText() : null;\n            if (pngBase64 == null || pngBase64.isEmpty()) {\n                throw new IOException(\"pdf2img PAGE_PNG_DATA is empty\");\n            }\n\n            byte[] pngBytes;\n            try {\n                pngBytes = Base64.getDecoder().decode(pngBase64);\n            } catch (IllegalArgumentException e) {","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/opendataloader-project/opendataloader-pdf/blob/a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8/java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/hybrid/HancomAIClient.java#L682-L718","documentation":"fetchPageImage parsed the response JSON but the top-level RESULT field is missing, not an array, or empty. The code navigates RESULT[0].RESULT.PAGE_PNG_DATA, so a missing/empty RESULT array means the backend did not return a page render. Per-page IOException, caught and logged by table/figure handlers.","triggerScenarios":"objectMapper.readTree(body) succeeds but root.get(\"RESULT\") is null, not a JsonNode array, or has size 0.","commonSituations":"Backend returned SUCCESS=false but fetchPageImage still got 2xx with an error envelope lacking RESULT; version skew changing the pdf2img response shape; backend partial failure on the requested PAGE_INDEX.","solutions":["Log the raw pdf2img response body to see the actual envelope (often a SUCCESS=false with MSG)","Check the backend logs for the failing PAGE_INDEX","Retry the page; if consistent, accept the per-page skip","Align client and backend pdf2img contract versions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return cache.getOrFetch(pageNum, idx -> client.fetchPageImage(pdf, idx, crop));\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"pdf2img RESULT is empty\")) {\n        log.warn(\"page {} produced no render result — backend may have rejected it\", pageNum);\n    }\n    continue; // skip this page\n}","preventionTips":["Log raw pdf2img bodies in staging to spot envelope changes","Keep client and backend pdf2img versions aligned","Accept per-page skips for degraded output"],"tags":["hybrid","hancom-ai","pdf2img","response-parsing"],"backgroundTag":null,"analyzedSha":"a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8","analyzedAt":"2026-08-14T05:22:03.953Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}