{"record":{"id":"6fa0c5a5aaf5d2ce","repo":"opendataloader-project/opendataloader-pdf","slug":"pdf2img-returned-empty-body","errorCode":null,"errorMessage":"pdf2img returned empty body","messagePattern":"pdf2img returned empty body","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/hybrid/HancomAIClient.java","lineNumber":693,"sourceCode":"                \"odl-\" + sourcePdfShaShort + \"-pdf2img-p\" + pageIndex)\n            .addFormDataPart(\"PAGE_INDEX\", String.valueOf(pageIndex))\n            .addFormDataPart(\"FILE\", DEFAULT_FILENAME,\n                RequestBody.create(pdfBytes, MEDIA_TYPE_PDF))\n            .build();\n\n        Request httpRequest = new Request.Builder()\n            .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()) {","sourceCodeStart":675,"sourceCodeEnd":711,"githubUrl":"https://github.com/opendataloader-project/opendataloader-pdf/blob/a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8/java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/hybrid/HancomAIClient.java#L675-L711","documentation":"The pdf2img endpoint returned 2xx but response.body() was null, so there is no JSON to parse for the page image. Like error 47 this points to a transport/proxy artifact rather than a content problem. It is a per-page IOException caught and logged by the table/figure handlers.","triggerScenarios":"POST to /support/pdf2img returns 2xx with a null ResponseBody inside fetchPageImage.","commonSituations":"A proxy/gateway between client and backend that strips or empties the body on the page render response; backend returning 204 by mistake; connection reuse closing the stream early.","solutions":["Hit the backend pdf2img endpoint directly, bypassing proxies","Confirm the backend returns 200 with a JSON body for pdf2img","Retry the page render; transient null bodies are often connection artifacts","Accept the per-page skip if it affects only some pages"],"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 (\"pdf2img returned empty body\".equals(e.getMessage())) {\n        // retry once — often a proxy/connection artifact\n        return cache.getOrFetch(pageNum, idx -> client.fetchPageImage(pdf, idx, crop));\n    }\n    log.warn(\"skipping page {}: {}\", pageNum, e.getMessage());\n    continue;\n}","preventionTips":["Avoid proxies between client and the pdf2img service","Confirm the backend returns 200 with a JSON body, not 204","Treat recurring empty bodies as a backend/proxy defect"],"tags":["hybrid","hancom-ai","pdf2img","response-parsing","proxy"],"backgroundTag":null,"analyzedSha":"a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8","analyzedAt":"2026-08-14T05:22:03.953Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}