Tencent/matrix · error · TaskInitException

---APK-UNZIP-PATH ' 'is not exists!

Error message

---APK-UNZIP-PATH '<inputPath>'is not exists!

What it means

DuplicateFileTask.init() throws TaskInitException when the configured unzip path does not exist on disk. After checking non-null, it verifies inputFile.exists(); a missing directory means the APK was never unzipped or the path is wrong.

Solutions

  1. Verify the directory exists: run `ls <unzipPath>` and correct the path if needed.
  2. Run UnzipTask (or unzip the APK manually) so the directory exists before check tasks.
  3. Use an absolute path for --unzip to avoid working-directory ambiguity.

Example fix

// before
config.setUnzipPath("build/unzipped-apk"); // relative, doesn't exist
// after
File dir = new File("/abs/path/build/unzipped-apk");
if (!dir.exists()) {
    new UnzipTask().unzip(apkFile, dir); // create it first
}
config.setUnzipPath(dir.getAbsolutePath());
Defensive patterns

Strategy: validation

Validate before calling

File dir = new File(config.getUnzipPath());
if (!dir.exists()) {
    throw new IllegalStateException("unzip path does not exist: " + dir.getAbsolutePath());
}

Try / catch

try {
    task.init();
} catch (TaskInitException e) {
    if (e.getMessage().contains("is not exists")) {
        unzipApk(apkFile, new File(config.getUnzipPath()));
        task.init();
    }
}

Prevention

When it happens

Trigger: config.getUnzipPath() points to a non-existent filesystem path when DuplicateFileTask.init() runs.

Common situations: Typo in the --unzip path; unzip output directory deleted by a clean build; relative path resolved from a different working directory; unzip step skipped or failed earlier.

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


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/4258e16b9bc3e0b8. Report an issue: GitHub.

Appendix: source

Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/DuplicateFileTask.java:71

    private List<Pair<String, Long>> fileSizeList;
    private Map<String, Pair<Long, Long>> entrySizeMap;
    private Map<String, String> entryNameMap;

    public DuplicateFileTask(JobConfig config, Map<String, String> params) {
        super(config, params);
        type = TaskFactory.TASK_TYPE_DUPLICATE_FILE;
    }

    @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!");
        }
        inputFile = new File(inputPath);
        if (!inputFile.exists()) {
            throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "'is not exists!");
        } else if (!inputFile.isDirectory()) {
            throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not directory!");
        }
        md5Map = new HashMap<>();
        fileSizeList = new ArrayList<>();
        entrySizeMap = config.getEntrySizeMap();
        entryNameMap = config.getEntryNameMap();
    }

    private void computeMD5(File file) throws NoSuchAlgorithmException, IOException {
        if (file != null) {
            if (file.isDirectory()) {
                File[] files = file.listFiles();
                for (File resFile : files) {
                    computeMD5(resFile);
                }
            } else {
                MessageDigest msgDigest = MessageDigest.getInstance("MD5");

View on GitHub (pinned to 3b8293bd65)