Tencent/matrix · error · TaskInitException

---APK-UNZIP-PATH can not be null!

Error message

---APK-UNZIP-PATH can not be null!

What it means

In MultiSTLCheckTask.init(), after validating the nm tool, the unzip path is checked: if config.getUnzipPath() is null/empty the task cannot locate the lib/ directory of native libraries and throws TaskInitException with this message.

Solutions

  1. Set config.setUnzipPath(...) to the unzipped APK directory before running the task.
  2. Ensure the unzip task ran and the directory contains a lib/ folder.
  3. Centralize job config construction so all tasks receive the same populated config.

Example fix

// before
config.setToolNm(nmPath); // unzip path forgotten
// after
config.setToolNm(nmPath);
config.setUnzipPath("/tmp/build/apk-unzipped");
Defensive patterns

Strategy: validation

Validate before calling

String p = config.getUnzipPath();
if (p == null || p.isEmpty() || !new File(p, "lib").isDirectory()) {
    throw new IllegalStateException("MultiSTLCheckTask needs unzip path containing lib/");
}

Try / catch

try {
    task.init();
} catch (TaskInitException e) {
    if (e.getMessage().contains("APK-UNZIP-PATH can not be null")) {
        // set unzip path and rerun
    }
}

Prevention

When it happens

Trigger: Running MultiSTLCheckTask with a valid nm tool path but an unset/empty config.getUnzipPath(), so new File(inputPath, "lib") cannot be created.

Common situations: Configuring the nm tool but forgetting the unzip path; unzip step skipped; config object constructed per-task with only some fields populated.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

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

            while (matcher.find()) {
                if (!Util.isNullOrNil(matcher.group())) {
                    String env = System.getenv(matcher.group().substring(1));
                    Log.d(TAG, "%s -> %s", matcher.group().substring(1), env);
                    if (!Util.isNullOrNil(env)) {
                        toolnmPath = toolnmPath.replace(matcher.group(), env);
                    }
                }
            }
            Log.i(TAG, "toolnm pah is %s", toolnmPath);
        }
        if (!FileUtil.isLegalFile(toolnmPath)) {
            throw new TaskInitException(TAG + "---Can not find the tool 'nm'!");
        }
        if (!Util.isNullOrNil(inputPath)) {
            Log.i(TAG, "inputPath:%s", inputPath);
            libDir = new File(inputPath, "lib");
        } else {
            throw new TaskInitException(TAG + "---APK-UNZIP-PATH can not be null!");
        }

    }

    private boolean isStlLinked(File libFile) throws IOException, InterruptedException {
        ProcessBuilder processBuilder = new ProcessBuilder(toolnmPath, "-D", "-C", libFile.getAbsolutePath());
        Process process = processBuilder.start();
        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
        String line = reader.readLine();
        while (line != null) {
            String[] columns = line.split(" ");
            Log.d(TAG, "%s", line);
            if (columns.length >= 3 && columns[1].equals("T") && columns[2].startsWith("std::")) {
                return true;
            }
            line = reader.readLine();
        }
        reader.close();

View on GitHub (pinned to 3b8293bd65)