iBotPeaches/Apktool · error · PathNotExist

Entry not found:

Error message

Entry not found: 

What it means

ZipRODirectory.getZipFileEntry looks an entry up in the underlying ZipFile and throws PathNotExist (a DirectoryException subtype) when getEntry returns null — the requested name simply is not in that ZIP, with the message naming it. Callers use this to fetch resources.arsc and other APK members.

Source

Thrown at brut.j.dir/src/main/java/brut/directory/ZipRODirectory.java:94

            if (pos == -1) {
                if (!entry.isDirectory()) {
                    mFiles.add(subname);
                    continue;
                }
            } else {
                subname = subname.substring(0, pos);
            }

            if (!mDirs.containsKey(subname)) {
                mDirs.put(subname, new ZipRODirectory(mZipFile, mPath + subname + separator));
            }
        }
    }

    private ZipEntry getZipFileEntry(String name) throws DirectoryException {
        ZipEntry entry = mZipFile.getEntry(name);
        if (entry == null) {
            throw new PathNotExist("Entry not found: " + name);
        }
        return entry;
    }

    @Override
    protected InputStream getFileInputImpl(String name) throws DirectoryException {
        try {
            return mZipFile.getInputStream(new ZipEntry(mPath + name));
        } catch (IOException ex) {
            throw new PathNotExist(name, ex);
        }
    }

    @Override
    public long getSize(String name) throws DirectoryException {
        ZipEntry entry = getZipFileEntry(name);
        return entry.getSize();
    }

View on GitHub (pinned to 79b63384d7)

Solutions

  1. List actual entries (`unzip -l` or ZipFile.stream()) and use the exact name shown
  2. For split APKs, locate which split contains the entry and open that file
  3. Handle PathNotExist specifically — it is a distinct subtype, so catch it apart from generic DirectoryException
  4. Check case sensitivity and leading path components of the requested name

Example fix

// before
InputStream in = zipDir.getFileInput("resources.arsc"); // absent -> Entry not found

// after
try {
    InputStream in = zipDir.getFileInput("resources.arsc");
} catch (PathNotExist e) {
    // entry genuinely absent; fall back to listing what exists
    for (String f : zipDir.getFiles(true)) { /* inspect */ }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm the entry exists before asking for its stream
try (ZipFile zf = new ZipFile(apkFile)) {
    if (zf.getEntry(mPath + name) == null) {
        throw new IllegalArgumentException("No entry '" + name + "' in " + apkFile);
    }
}

Type guard

boolean zipHasEntry(ZipFile zf, String name) {
    return zf.getEntry(name) != null;
}

Try / catch

try {
    InputStream in = zipDir.getFileInput(name);
} catch (PathNotExist e) {
    // distinct subtype: entry absent — list zipDir.getFiles(true) and adjust the name
    // treat as a data problem, not a crash
}

Prevention

When it happens

Trigger: Requesting a ZIP entry name that does not exist: wrong path prefix (entries under res/ vs root), wrong case, or expecting an entry (like resources.arsc) in an APK that lacks it.

Common situations: Programmatic resource extraction assuming a standard APK layout; split APKs where the entry lives in another split; obfuscated/renamed archives whose entry names differ from the expected ones.

Related errors


AI-assisted analysis of iBotPeaches/Apktool@79b63384d7 (2026-08-14). Data as JSON: /api/errors/8fbbec1ac9d8c3ee. Report an issue: GitHub.