{"record":{"id":"d1e94af49970f332","repo":"iBotPeaches/Apktool","slug":"input-file-path-was-not-found-or-was-not","errorCode":null,"errorMessage":"Input file (\" + path + \") was not found or was not readable.","messagePattern":"Input file \\(\" \\+ path \\+ \"\\) was not found or was not readable\\.","errorType":"exception","errorClass":"InFileNotFoundException","httpStatus":null,"severity":"error","filePath":"brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java","lineNumber":65,"sourceCode":"\n    private final ExtFile mApkFile;\n    private final Config mConfig;\n    private final AtomicReference<AndrolibException> mFirstError;\n\n    private ApkInfo mApkInfo;\n    private SmaliDecoder mSmaliDecoder;\n    private ResDecoder mResDecoder;\n    private BackgroundWorker mWorker;\n\n    public ApkDecoder(File apkFile, Config config) {\n        mApkFile = new ExtFile(apkFile);\n        mConfig = config;\n        mFirstError = new AtomicReference<>();\n    }\n\n    public void decode(File outDir) throws AndrolibException {\n        if (!mApkFile.isFile() || !mApkFile.canRead()) {\n            throw new InFileNotFoundException(mApkFile.getPath());\n        }\n        // We don't follow symlinks here for safety reasons.\n        if (Files.exists(outDir.toPath(), LinkOption.NOFOLLOW_LINKS)) {\n            if (Files.isDirectory(outDir.toPath(), LinkOption.NOFOLLOW_LINKS)) {\n                if (!mConfig.isForced() && BrutIO.isNonEmptyDirectory(outDir)) {\n                    throw new OutDirExistsException(outDir.getPath());\n                }\n                OS.rmdir(outDir);\n            } else {\n                if (!mConfig.isForced()) {\n                    throw new OutDirExistsException(outDir.getPath());\n                }\n                OS.rmfile(outDir);\n            }\n        }\n        OS.mkdir(outDir);\n\n        if (mConfig.getJobs() > 1) {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkDecoder.java#L47-L83","documentation":"InFileNotFoundException is thrown by ApkDecoder.decode() when the input APK is not a regular file or cannot be read (mApkFile.isFile() || canRead() checks fail). It is the decode-side guard that the input path exists and is readable before any unpacking happens. The path in the message is the absolute/normalized path of the File passed to the ApkDecoder constructor.","triggerScenarios":"Calling `new ApkDecoder(new File(path), config).decode(outDir)` with a nonexistent path, a directory, a dangling symlink (isFile() is false), or a file without read permission for the current user.","commonSituations":"Typos in the APK path; running apktool d as a user without read access (permissions/ownership issues); passing a glob or URL instead of a local file; symlinked APK that points to a removed target.","solutions":["Verify the path exists and is a regular file: `ls -l <apk>` and correct typos.","Fix permissions: `chmod +r <apk>` or run as a user that can read it.","If using a symlink, make sure its target exists, or pass the real path."],"exampleFix":"// before\nnew ApkDecoder(new File(args[0]), config).decode(outDir);\n// after\nFile apk = new File(args[0]);\nif (!apk.isFile() || !apk.canRead()) {\n    throw new IllegalArgumentException(\"Cannot read APK: \" + apk.getAbsolutePath());\n}\nnew ApkDecoder(apk, config).decode(outDir);","handlingStrategy":"validation","validationCode":"File apk = new File(path);\nif (!apk.isFile() || !apk.canRead()) {\n    throw new IllegalArgumentException(\"APK missing or unreadable: \" + apk.getAbsolutePath());\n}\nApkDecoder decoder = new ApkDecoder(apk, config);","typeGuard":null,"tryCatchPattern":"try { decoder.decode(outDir); } catch (InFileNotFoundException e) { /* report path, check spelling/perms */ }","preventionTips":["Resolve and validate input paths with isFile()+canRead() before constructing ApkDecoder.","Canonicalize user-supplied paths (getCanonicalPath) to surface symlink targets."],"tags":["apktool","file-io","validation","decode"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}