skylot/jadx · error · IOException
Failed to open zip: {}
Error message
Failed to open zip: {} What it means
Thrown by ZipReader.open inside the generic catch block: when an exception (other than FallbackException) occurs AND the options contain ZipReaderFlags.DONT_USE_FALLBACK, jadx rethrows as IOException with message 'Failed to open zip: <file>' chaining the original cause. Without that flag jadx would instead silently switch to the fallback parser.
Source
Thrown at jadx-commons/jadx-zip/src/main/java/jadx/zip/ZipReader.java:55
public ZipReader(ZipReaderOptions options) {
this.options = options;
}
@SuppressWarnings("resource")
public ZipContent open(File zipFile) throws IOException {
if (!zipFile.exists()) {
throw new FileNotFoundException(zipFile.getAbsolutePath());
}
try {
JadxZipParser jadxParser = new JadxZipParser(zipFile, options);
IZipParser detectedParser = detectParser(zipFile, jadxParser);
return detectedParser.open();
} catch (FallbackException e) {
throw e;
} catch (Exception e) {
if (options.getFlags().contains(ZipReaderFlags.DONT_USE_FALLBACK)) {
throw new IOException("Failed to open zip: " + zipFile, e);
}
// switch to fallback parser
return buildFallbackParser(zipFile).open();
}
}
/**
* Visit valid entries in a zip file.
* Return not null value from visitor to stop iteration.
*/
public <R> @Nullable R visitEntries(File file, Function<IZipEntry, R> visitor) {
try (ZipContent content = open(file)) {
for (IZipEntry entry : content.getEntries()) {
R result = visitor.apply(entry);
if (result != null) {
return result;
}
}View on GitHub (pinned to e738a26571)
Solutions
- If fallback is acceptable, do NOT set ZipReaderFlags.DONT_USE_FALLBACK so jadx can retry with the fallback parser.
- Verify the input is a valid zip (unzip -t or a zip integrity check).
- Re-download or rebuild the archive if corrupt.
- Inspect the chained cause for the specific parse failure.
Example fix
// before
ZipReaderOptions opts = new ZipReaderOptions(security,
ZipReaderFlags.of(ZipReaderFlags.DONT_USE_FALLBACK));
new ZipReader(opts).open(file);
// after
ZipReaderOptions opts = new ZipReaderOptions(security, ZipReaderFlags.none());
new ZipReader(opts).open(file); Defensive patterns
Strategy: fallback
Validate before calling
// Decide upfront whether fallback is acceptable for your use case boolean strict = mustValidateOnly(); ZipReaderFlags flags = strict ? ZipReaderFlags.of(ZipReaderFlags.DONT_USE_FALLBACK) : ZipReaderFlags.none(); ZipReader reader = new ZipReader(new ZipReaderOptions(security, flags));
Type guard
public static boolean canOpenWithoutFallback(ZipReader r, File f) {
try { r.open(f); return true; } catch (IOException e) { return false; }
} Try / catch
try {
reader.open(file);
} catch (IOException e) {
if (e.getMessage().startsWith("Failed to open zip")) {
// retry with fallback enabled
ZipReaderOptions relaxed = new ZipReaderOptions(security, ZipReaderFlags.none());
new ZipReader(relaxed).open(file);
} else throw e;
} Prevention
- Do not set DONT_USE_FALLBACK unless you require strict validation.
- Verify zip integrity (unzip -t) before strict parsing.
- Log the chained cause to diagnose the primary parser failure.
When it happens
Trigger: Opening a zip/apk that the primary JadxZipParser cannot parse (corrupt, unusual format, unsupported compression), while the caller has requested DONT_USE_FALLBACK so the fallback parser is bypassed.
Common situations: Corrupted or truncated APK/JAR; intentionally malformed test input; zip using features the jadx parser rejects; caller explicitly disabled fallback for strict validation.
Related errors
- {}
- Failed to process zip file: {}
- Failed to process zip entry: {}
- Failed to save JSON file: {}
- Failed to save JSON file: {}
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/ae9e57c85e9d733a.
Report an issue: GitHub.