{"record":{"id":"bd319347c2688c8d","repo":"Tencent/matrix","slug":"apk-unzip-path-inputpath-is-not-exist-bd3193","errorCode":null,"errorMessage":"---APK-UNZIP-PATH '<inputPath>' is not exist!","messagePattern":"---APK-UNZIP-PATH '<inputPath>' is not exist!","errorType":"exception","errorClass":"TaskInitException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/CountRTask.java","lineNumber":75,"sourceCode":"        super(config, params);\n        type = TASK_TYPE_COUNT_R_CLASS;\n        dexFileNameList = new ArrayList<>();\n        dexFileList = new ArrayList<>();\n        classesMap = new HashMap<>();\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n        String inputPath = config.getUnzipPath();\n\n        if (Util.isNullOrNil(inputPath)) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH can not be null!\");\n        }\n\n        inputFile = new File(inputPath);\n        if (!inputFile.exists()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not exist!\");\n        }\n        if (!inputFile.isDirectory()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not directory!\");\n        }\n\n        File[] files = inputFile.listFiles();\n        try {\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                        RandomAccessFile randomAccessFile = new RandomAccessFile(file, \"rw\");\n                        dexFileList.add(randomAccessFile);\n                    }\n                }\n            }\n        } catch (FileNotFoundException e) {\n            throw new TaskInitException(e.getMessage(), e);","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/CountRTask.java#L57-L93","documentation":"CountRTask.init() checks that the configured unzip path exists on disk. If the File constructed from config.getUnzipPath() does not exist, it throws TaskInitException that names the missing path. The task needs the extracted APK directory to scan for R classes.","triggerScenarios":"CountRTask run with APK-UNZIP-PATH pointing to a directory that was never created (unzip failed/skipped), removed by a clean, or given with a typo/relative path resolved against a different working directory.","commonSituations":"CI cleaning intermediate outputs between steps; unzip step silently failing; relative path used while the checker runs from another directory; reusing a cached config from a previous machine.","solutions":["Re-run the unzip step and confirm the target directory exists before executing CountRTask.","Configure an absolute path via config.setUnzipPath(file.getAbsolutePath()).","Make unzip failures fatal so the check tasks are skipped when the directory is missing.","Print the absolute path of the configured value in logs to catch typos and wrong working directories."],"exampleFix":"// before\nconfig.setUnzipPath(\"/tmp/old-build/unzipped\"); // deleted by CI clean\n// after\nFile dir = new File(\"build/apk-unzipped\");\nif (!dir.exists()) {\n    dir = unzipApkTask.run();\n}\nconfig.setUnzipPath(dir.getAbsolutePath());","handlingStrategy":"validation","validationCode":"File dir = new File(config.getUnzipPath());\nif (!dir.exists()) {\n    unzipStep.run(); // recreate the extracted directory\n}\nif (!dir.exists()) {\n    throw new IllegalStateException(\"unzip dir still missing: \" + dir.getAbsolutePath());\n}","typeGuard":"boolean unzipDirExists(JobConfig config) {\n    String p = config.getUnzipPath();\n    return p != null && new File(p).exists();\n}","tryCatchPattern":"try {\n    countRTask.init();\n} catch (TaskInitException e) {\n    MatrixLog.e(TAG, \"unzip path missing, re-running unzip step: %s\", e.getMessage());\n    throw e;\n}","preventionTips":["Chain unzip -> check tasks so the directory always exists when checks run.","Use absolute paths resolved at job start.","Make unzip failures abort the job instead of continuing.","Log the absolute path in the config for CI debugging."],"tags":["apk-canary","task-init","file-not-found","unzip-path"],"backgroundTag":"file-not-found","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"}