{"record":{"id":"fb9ff220678f100b","repo":"skylot/jadx","slug":"failed-to-process-zip-file","errorCode":null,"errorMessage":"Failed to process zip file: {}","messagePattern":"Failed to process zip file: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-commons/jadx-zip/src/main/java/jadx/zip/ZipReader.java","lineNumber":75,"sourceCode":"\t\t\t// switch to fallback parser\n\t\t\treturn buildFallbackParser(zipFile).open();\n\t\t}\n\t}\n\n\t/**\n\t * Visit valid entries in a zip file.\n\t * Return not null value from visitor to stop iteration.\n\t */\n\tpublic <R> @Nullable R visitEntries(File file, Function<IZipEntry, R> visitor) {\n\t\ttry (ZipContent content = open(file)) {\n\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() {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-commons/jadx-zip/src/main/java/jadx/zip/ZipReader.java#L57-L93","documentation":"Thrown by ZipReader.visitEntries as a RuntimeException wrapping any exception raised while iterating entries of a zip via open() and applying the visitor. The message includes the absolute file path. Because visitEntries opens the content and iterates, failures can originate from opening the zip or from internal iteration.","triggerScenarios":"Calling visitEntries(file, visitor) on a file that cannot be opened or whose entries raise during iteration; any exception escaping the try-with-resources on the ZipContent is wrapped here.","commonSituations":"Corrupt archive that opens but fails mid-iteration; an entry stream read error; a security filter rejecting entries causing an internal throw; I/O error during decompression.","solutions":["Inspect the wrapped cause for the underlying IOException/security rejection.","Validate the zip integrity before iterating (unzip -t).","If a security filter is rejecting entries, review the IJadxZipSecurity configuration.","Rebuild or re-download the archive if it is corrupt."],"exampleFix":"// before\nreader.visitEntries(file, e -> process(e));\n// after\nif (!isZipValid(file)) throw new IllegalArgumentException(\"bad zip\");\nreader.visitEntries(file, e -> process(e));","handlingStrategy":"try-catch","validationCode":"// Pre-check that the file is a readable zip\npublic static boolean isReadableZip(File f) {\n    if (!f.isFile()) return false;\n    try (java.util.zip.ZipFile zf = new java.util.zip.ZipFile(f)) { return true; }\n    catch (IOException e) { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n    reader.visitEntries(file, visitor);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Failed to process zip file\")) {\n        LOG.error(\"Cannot process zip {}\", file.getAbsolutePath(), e.getCause());\n        // optionally skip this file in a batch\n    } else throw e;\n}","preventionTips":["Validate archives with unzip -t before batch processing.","Configure IJadxZipSecurity to expect your archive contents.","Log per-file failures in batch jobs so one bad file does not abort the run."],"tags":["zip","io","jadx"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}