{"record":{"id":"8fbbec1ac9d8c3ee","repo":"iBotPeaches/Apktool","slug":"entry-not-found","errorCode":null,"errorMessage":"Entry not found: ","messagePattern":"Entry not found: ","errorType":"exception","errorClass":"PathNotExist","httpStatus":null,"severity":"error","filePath":"brut.j.dir/src/main/java/brut/directory/ZipRODirectory.java","lineNumber":94,"sourceCode":"            if (pos == -1) {\n                if (!entry.isDirectory()) {\n                    mFiles.add(subname);\n                    continue;\n                }\n            } else {\n                subname = subname.substring(0, pos);\n            }\n\n            if (!mDirs.containsKey(subname)) {\n                mDirs.put(subname, new ZipRODirectory(mZipFile, mPath + subname + separator));\n            }\n        }\n    }\n\n    private ZipEntry getZipFileEntry(String name) throws DirectoryException {\n        ZipEntry entry = mZipFile.getEntry(name);\n        if (entry == null) {\n            throw new PathNotExist(\"Entry not found: \" + name);\n        }\n        return entry;\n    }\n\n    @Override\n    protected InputStream getFileInputImpl(String name) throws DirectoryException {\n        try {\n            return mZipFile.getInputStream(new ZipEntry(mPath + name));\n        } catch (IOException ex) {\n            throw new PathNotExist(name, ex);\n        }\n    }\n\n    @Override\n    public long getSize(String name) throws DirectoryException {\n        ZipEntry entry = getZipFileEntry(name);\n        return entry.getSize();\n    }","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.j.dir/src/main/java/brut/directory/ZipRODirectory.java#L76-L112","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List actual entries (`unzip -l` or ZipFile.stream()) and use the exact name shown","For split APKs, locate which split contains the entry and open that file","Handle PathNotExist specifically — it is a distinct subtype, so catch it apart from generic DirectoryException","Check case sensitivity and leading path components of the requested name"],"exampleFix":"// before\nInputStream in = zipDir.getFileInput(\"resources.arsc\"); // absent -> Entry not found\n\n// after\ntry {\n    InputStream in = zipDir.getFileInput(\"resources.arsc\");\n} catch (PathNotExist e) {\n    // entry genuinely absent; fall back to listing what exists\n    for (String f : zipDir.getFiles(true)) { /* inspect */ }\n}","handlingStrategy":"try-catch","validationCode":"// Confirm the entry exists before asking for its stream\ntry (ZipFile zf = new ZipFile(apkFile)) {\n    if (zf.getEntry(mPath + name) == null) {\n        throw new IllegalArgumentException(\"No entry '\" + name + \"' in \" + apkFile);\n    }\n}","typeGuard":"boolean zipHasEntry(ZipFile zf, String name) {\n    return zf.getEntry(name) != null;\n}","tryCatchPattern":"try {\n    InputStream in = zipDir.getFileInput(name);\n} catch (PathNotExist e) {\n    // distinct subtype: entry absent — list zipDir.getFiles(true) and adjust the name\n    // treat as a data problem, not a crash\n}","preventionTips":["Catch PathNotExist separately from DirectoryException","Derive entry names from listing, never assume standard layout","For split APKs, open the split that actually owns the entry"],"tags":["apktool","zip","entry-not-found","directory"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}