Tencent/matrix · error · TaskInitException
---APK-UNZIP-PATH ' ' is not exist!
Error message
---APK-UNZIP-PATH '<inputPath>' is not exist!
What it means
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.
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.
Example fix
// before
config.setUnzipPath("build/unzipped-apk");
// after
File unzipDir = new File("build/unzipped-apk");
if (!unzipDir.exists()) {
throw new IllegalStateException("unzip dir missing, run unzip step first: " + unzipDir.getAbsolutePath());
}
config.setUnzipPath(unzipDir.getAbsolutePath()); Defensive patterns
Strategy: validation
Validate before calling
File dir = new File(config.getUnzipPath());
if (!dir.exists()) {
throw new IllegalStateException("unzip dir does not exist: " + dir.getAbsolutePath());
} Type guard
boolean unzipDirExists(JobConfig config) {
String p = config.getUnzipPath();
return p != null && new File(p).exists();
} Try / catch
try {
countClassTask.init();
} catch (TaskInitException e) {
MatrixLog.e(TAG, "re-run unzip step; configured path missing: %s", e.getMessage());
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- ---APK-UNZIP-PATH ' ' is not exist!
- ---APK-UNZIP-PATH can not be null!
- ---APK-UNZIP-PATH ' ' is not directory!
- ---APK-UNZIP-PATH can not be null!
- ---APK-UNZIP-PATH ' ' is not directory!
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/14eb41c8c5fba535.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/CountClassTask.java:81
type = TASK_TYPE_COUNT_CLASS;
dexFileNameList = new ArrayList<>();
dexFileList = new ArrayList<>();
}
@Override
public void init() throws TaskInitException {
super.init();
String inputPath = config.getUnzipPath();
if (Util.isNullOrNil(inputPath)) {
throw new TaskInitException(TAG + "---APK-UNZIP-PATH can not be null!");
}
Log.i(TAG, "input path:%s", inputPath);
inputFile = new File(inputPath);
if (!inputFile.exists()) {
throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not exist!");
}
if (!inputFile.isDirectory()) {
throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not directory!");
}
File[] files = inputFile.listFiles();
try {
if (files != null) {
for (File file : files) {
if (file.isFile() && file.getName().endsWith(ApkConstants.DEX_FILE_SUFFIX)) {
dexFileNameList.add(file.getName());
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
dexFileList.add(randomAccessFile);
}
}
}
} catch (FileNotFoundException e) {
throw new TaskInitException(e.getMessage(), e);View on GitHub (pinned to 3b8293bd65)