{"record":{"id":"bbe9d930eb2ee2a1","repo":"skylot/jadx","slug":"failed-to-process-zip-entry","errorCode":null,"errorMessage":"Failed to process zip entry: {}","messagePattern":"Failed to process zip entry: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-commons/jadx-zip/src/main/java/jadx/zip/ZipReader.java","lineNumber":86,"sourceCode":"\t\t\tfor (IZipEntry entry : content.getEntries()) {\n\t\t\t\tR result = visitor.apply(entry);\n\t\t\t\tif (result != null) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tthrow new RuntimeException(\"Failed to process zip file: \" + file.getAbsolutePath(), e);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic void readEntries(File file, BiConsumer<IZipEntry, InputStream> visitor) {\n\t\tvisitEntries(file, entry -> {\n\t\t\tif (!entry.isDirectory()) {\n\t\t\t\ttry (InputStream in = entry.getInputStream()) {\n\t\t\t\t\tvisitor.accept(entry, in);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tthrow new RuntimeException(\"Failed to process zip entry: \" + entry, e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\n\tpublic ZipReaderOptions getOptions() {\n\t\treturn options;\n\t}\n\n\tprivate IZipParser detectParser(File zipFile, JadxZipParser jadxParser) throws IOException {\n\t\tif (zipFile.getName().endsWith(\".apk\")\n\t\t\t\t|| options.getFlags().contains(ZipReaderFlags.DONT_USE_FALLBACK)) {\n\t\t\treturn jadxParser;\n\t\t}\n\t\tif (!jadxParser.canOpen()) {\n\t\t\treturn buildFallbackParser(zipFile);\n\t\t}","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-commons/jadx-zip/src/main/java/jadx/zip/ZipReader.java#L68-L104","documentation":"Thrown inside ZipReader.readEntries' visitor lambda as a RuntimeException wrapping any exception raised while reading a single zip entry's input stream. It fires per-entry: the entry is opened, the visitor BiConsumer is invoked with the InputStream, and any exception there is wrapped with the entry's toString.","triggerScenarios":"A specific entry's InputStream cannot be read (corrupt entry, decompression error, malformed data), or the visitor itself throws while processing the entry's bytes. Only non-directory entries reach this branch.","commonSituations":"One corrupted entry inside an otherwise valid archive; a decompression bomb or CRC mismatch; visitor code that fails parsing a particular entry's content; an entry using an unsupported compression method.","solutions":["Inspect the wrapped cause and the entry name in the message.","Skip or quarantine the failing entry if the rest of the archive is valid.","Verify CRCs (unzip -t) to confirm a corrupt entry.","Handle per-entry failures in the visitor with try-catch to continue processing others."],"exampleFix":"// before\nreader.readEntries(file, (entry, in) -> parse(in));\n// after\nreader.readEntries(file, (entry, in) -> {\n    try { parse(in); }\n    catch (Exception e) { LOG.warn(\"skip bad entry {}\", entry, e); }\n});","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Make your visitor resilient per-entry\nreader.readEntries(file, (entry, in) -> {\n    try {\n        handleEntry(entry, in);\n    } catch (Exception ex) {\n        LOG.warn(\"Skipping bad entry {} in {}\", entry, file.getName(), ex);\n    }\n});\n\n// Or catch at the readEntries boundary\ntry {\n    reader.readEntries(file, this::handleEntry);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Failed to process zip entry\")) {\n        LOG.warn(\"Bad entry encountered: {}\", e.getCause().toString());\n    } else throw e;\n}","preventionTips":["Wrap per-entry processing in try-catch so one bad entry does not abort iteration.","Verify CRCs (unzip -t) to catch corrupt entries ahead of time.","Log entry names on failure to enable targeted re-extraction."],"tags":["zip","io","per-entry","jadx"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}