{"record":{"id":"65c869bc1c135c33","repo":"opendataloader-project/opendataloader-pdf","slug":"no-imageio-writer-accepted-png-output-for-page-s","errorCode":null,"errorMessage":"No ImageIO writer accepted PNG output for page %s","messagePattern":"No ImageIO writer accepted PNG output for page (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/hybrid/DiskPageImageCache.java","lineNumber":64,"sourceCode":"\n    @Override\n    public BufferedImage getOrFetch(int pageIndex, PageImageFetcher fetcher) throws IOException {\n        Path file = tempDir.resolve(\"page-\" + pageIndex + \".png\");\n        if (Files.exists(file)) {\n            BufferedImage cached = ImageIO.read(file.toFile());\n            if (cached != null) {\n                return cached;\n            }\n            // Cached file is unreadable (corrupt or no ImageReader) — re-fetch.\n            LOGGER.log(Level.WARNING, \"Cached page image is unreadable, re-fetching: {0}\", file);\n            Files.deleteIfExists(file);\n        }\n        BufferedImage image = fetcher.fetch(pageIndex);\n        if (image == null) {\n            throw new IOException(\"Page image fetcher returned null for page \" + pageIndex);\n        }\n        if (!ImageIO.write(image, \"png\", file.toFile())) {\n            throw new IOException(\"No ImageIO writer accepted PNG output for page \" + pageIndex);\n        }\n        return image;\n    }\n\n    @Override\n    public void evict(int pageIndex) {\n        // no-op: keep on disk for potential re-read\n    }\n\n    @Override\n    public void close() throws IOException {\n        if (!Files.exists(tempDir)) {\n            return;\n        }\n        try (DirectoryStream<Path> stream = Files.newDirectoryStream(tempDir)) {\n            for (Path entry : stream) {\n                try {\n                    Files.deleteIfExists(entry);","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/opendataloader-project/opendataloader-pdf/blob/a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8/java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/hybrid/DiskPageImageCache.java#L46-L82","documentation":"After fetching a page image, DiskPageImageCache persists it with ImageIO.write(image, \"png\", file). ImageIO.write returns false when no registered ImageWriter accepts the PNG format for that image type, which the cache treats as a fatal IOException because caching would silently produce nothing. It indicates the PNG writer plugin is unavailable in the runtime JRE.","triggerScenarios":"ImageIO.write returns false for the 'png' format — i.e. no ImageIO service provider for PNG is registered, or the BufferedImage type is one no writer will accept. The page index is included in the message.","commonSituations":"Running on a stripped/headless JRE or a minimal container image that omits the javax.imageio PNG plugins; shading/dependency conflicts that drop imageio plugins; custom BufferedImage subtypes with an unusual color model.","solutions":["Use a full JRE/JDK distribution (not a jlink-stripped runtime) so com.sun.imageio.plugins.png is present","Verify PNG support at startup: ImageIO.getImageWritersByFormatName(\"png\").hasNext()","If packaging with jlink, include the java.desktop module","Check for dependency shading that relocates/excludes imageio service files under META-INF/services"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify PNG write support once at startup\nboolean pngOk = javax.imageio.ImageIO.getImageWritersByFormatName(\"png\").hasNext();\nif (!pngOk) {\n    throw new IllegalStateException(\n        \"No ImageIO PNG writer registered — use a full JRE/JDK, not a stripped runtime\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    return cache.getOrFetch(pageIndex, fetcher);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"No ImageIO writer accepted PNG\")) {\n        LOG.error(\"PNG ImageIO plugin missing from JRE — install java.desktop / full JDK\", e);\n    }\n    throw e;\n}","preventionTips":["Run on a full JDK, not a jlink-stripped runtime missing java.desktop","Smoke-test ImageIO PNG writers in CI on the production image","Watch for dependency shading that drops META-INF/services imageio entries"],"tags":["image-io","png","classpath","hybrid","jre"],"backgroundTag":null,"analyzedSha":"a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8","analyzedAt":"2026-08-14T05:22:03.953Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}