{"record":{"id":"cffbae579a2ff250","repo":"Tencent/matrix","slug":"tag-apk-unzip-path-inputpath-is-no-cffbae","errorCode":null,"errorMessage":"TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not directory!\"","messagePattern":"TAG \\+ \"---APK-UNZIP-PATH '\" \\+ inputPath \\+ \"' is not directory!\"","errorType":"exception","errorClass":"TaskInitException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnusedAssetsTask.java","lineNumber":84,"sourceCode":"        dexFileNameList = new ArrayList<>();\n        ignoreSet = new HashSet<>();\n        assetsPathSet = new HashSet<>();\n        assetRefSet = new HashSet<>();\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n\n        String inputPath = config.getUnzipPath();\n        if (Util.isNullOrNil(inputPath)) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH can not be null!\");\n        }\n        inputFile = new File(inputPath);\n        if (!inputFile.exists()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not exist!\");\n        } else if (!inputFile.isDirectory()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not directory!\");\n        }\n        if (params.containsKey(JobConstants.PARAM_IGNORE_ASSETS_LIST) && !Util.isNullOrNil(params.get(JobConstants.PARAM_IGNORE_ASSETS_LIST))) {\n            String[] ignoreAssets = params.get(JobConstants.PARAM_IGNORE_ASSETS_LIST).split(\",\");\n            Log.i(TAG, \"ignore assets %d\", ignoreAssets.length);\n            for (String ignore : ignoreAssets) {\n                ignoreSet.add(Util.globToRegexp(ignore));\n            }\n        }\n\n        File[] files = inputFile.listFiles();\n        if (files != null) {\n            for (File file : files) {\n                if (file.isFile() && file.getName().endsWith(ApkConstants.DEX_FILE_SUFFIX)) {\n                    dexFileNameList.add(file.getName());\n                }\n            }\n        }\n    }","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnusedAssetsTask.java#L66-L102","documentation":"Thrown from UnusedAssetsTask.init() when the configured unzip path exists but is not a directory. The task scans the extracted APK's assets directory for unused asset files, so a non-directory path (e.g. the APK file itself) is rejected with TaskInitException during initialization.","triggerScenarios":"Passing the .apk file itself instead of the unzipped directory to APK-UNZIP-PATH; unzip produced a single archive file instead of an extracted tree.","commonSituations":"Config mix-up between APK-FILE-PATH and APK-UNZIP-PATH keys; unzip step misconfigured to keep the zip instead of extracting.","solutions":["Point APK-UNZIP-PATH at the extracted directory, not the .apk file.","If the path is the APK, move that value to APK-FILE-PATH and run the unzip task.","Add a pre-run check that new File(unzipPath).isDirectory()."],"exampleFix":"// before\nconfig.setApkUnzipPath(\"app-release.apk\"); // wrong key usage\n// after\nconfig.setApkPath(\"app-release.apk\");\nconfig.setApkUnzipPath(\"build/unzipped-apk\"); // extracted directory","handlingStrategy":"validation","validationCode":"File f = new File(unzipPath);\nif (f.exists() && !f.isDirectory()) {\n    throw new IllegalStateException(\"APK-UNZIP-PATH must be a directory, got a file: \" + unzipPath);\n}","typeGuard":"boolean isDirectory(File f) { return f != null && f.isDirectory(); }","tryCatchPattern":"try {\n    job.run();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"is not directory\")) {\n        log.error(\"'{}' is the APK file, not the unzipped dir; fix APK-FILE-PATH vs APK-UNZIP-PATH\", unzipPath);\n    } else throw e;\n}","preventionTips":["Don't swap the APK-FILE-PATH and APK-UNZIP-PATH config values.","Ensure unzip actually extracts (not just copies the archive).","Assert isDirectory() on the unzip output before analysis tasks.","Standardize unzip output into a fixed build/ subdirectory."],"tags":["android","apk-canary","config","wrong-path-type"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}