{"record":{"id":"14eb41c8c5fba535","repo":"Tencent/matrix","slug":"apk-unzip-path-inputpath-is-not-exist","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/CountClassTask.java","lineNumber":81,"sourceCode":"        type = TASK_TYPE_COUNT_CLASS;\n        dexFileNameList = new ArrayList<>();\n        dexFileList = new ArrayList<>();\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        Log.i(TAG, \"input path:%s\", inputPath);\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":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/CountClassTask.java#L63-L99","documentation":"CountClassTask.init() validates that the configured unzip path actually exists on disk. After the null/empty check, it wraps the path in a File and tests exists(); if the file does not exist it throws TaskInitException naming the path. The task needs the extracted APK directory to enumerate class files.","triggerScenarios":"Running CountClassTask with config.getUnzipPath() pointing at a path that was never created (unzip step skipped/failed), was deleted before the task ran, or contains a typo or wrong absolute/relative path in the configuration.","commonSituations":"CI workspace cleaned between the unzip and check steps; unzip step failed earlier but the job continued; using a relative path while the task runs in a different working directory; stale cache pointing at a previous build's temp directory.","solutions":["Verify the path exists (new File(path).exists()) before running the job and re-run the unzip step if it is missing.","Use an absolute canonical path when configuring APK-UNZIP-PATH.","Make the unzip step fail the job so subsequent tasks never run against a missing directory.","Log File.getCanonicalPath() of the configured value to spot typos or wrong working directories."],"exampleFix":"// before\nconfig.setUnzipPath(\"build/unzipped-apk\");\n// after\nFile unzipDir = new File(\"build/unzipped-apk\");\nif (!unzipDir.exists()) {\n    throw new IllegalStateException(\"unzip dir missing, run unzip step first: \" + unzipDir.getAbsolutePath());\n}\nconfig.setUnzipPath(unzipDir.getAbsolutePath());","handlingStrategy":"validation","validationCode":"File dir = new File(config.getUnzipPath());\nif (!dir.exists()) {\n    throw new IllegalStateException(\"unzip dir does not exist: \" + 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    countClassTask.init();\n} catch (TaskInitException e) {\n    MatrixLog.e(TAG, \"re-run unzip step; configured path missing: %s\", e.getMessage());\n    throw e;\n}","preventionTips":["Use absolute canonical paths in config.","Guarantee the unzip step runs first and fails the job on error.","Avoid CI cleans between unzip and check steps, or re-unzip afterwards.","Log File.getCanonicalPath() of the configured path for diagnosis."],"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"}