Tencent/matrix · error · TaskInitException

---The path of tool 'nm' is not given!

Error message

---The path of tool 'nm' is not given!

What it means

MultiSTLCheckTask uses the external 'nm' tool to inspect .so symbol tables. Its init() reads params.get(JobConstants.PARAM_TOOL_NM); if the path to nm is missing or empty, it throws TaskInitException with this message.

Solutions

  1. Pass the nm tool path in params, e.g. params.put(JobConstants.PARAM_TOOL_NM, "/path/to/ndk/toolchains/.../nm").
  2. Point it at the NDK-provided nm binary matching your platform (llvm-nm/nm in the NDK toolchain directory).
  3. If using env-var interpolation in the path (e.g. $ANDROID_NDK/...), ensure that env var is set in the environment.

Example fix

// before
Map<String, String> params = new HashMap<>(); // no PARAM_TOOL_NM
// after
params.put(JobConstants.PARAM_TOOL_NM,
    "/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-nm");
Defensive patterns

Strategy: validation

Validate before calling

String nm = params.get(JobConstants.PARAM_TOOL_NM);
if (nm == null || nm.isEmpty()) {
    throw new IllegalStateException("PARAM_TOOL_NM is required for MultiSTLCheckTask");
}

Try / catch

try {
    task.init();
} catch (TaskInitException e) {
    if (e.getMessage().contains("tool 'nm'")) {
        // add PARAM_TOOL_NM to params pointing at NDK nm/llvm-nm
    }
}

Prevention

When it happens

Trigger: Launching MultiSTLCheckTask without passing JobConstants.PARAM_TOOL_NM in the task params map, or passing an empty/null value for the nm tool path.

Common situations: Running the checker on a machine without NDK toolchain configuration; forgetting the tool-nm CLI/Gradle option; params map built without the tool entries expected by apk-canary.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/6cdb3846f278fc38. 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:67

public class MultiSTLCheckTask extends ApkTask {

    private static final String TAG = "Matrix.MultiSTLCheckTask";

    private File libDir;
    private String toolnmPath;

    public MultiSTLCheckTask(JobConfig jobConfig, Map<String, String> params) {
        super(jobConfig, params);
        type = TASK_TYPE_CHECK_MULTISTL;
    }

    @Override
    public void init() throws TaskInitException {
        super.init();
        final String inputPath = config.getUnzipPath();
        toolnmPath = params.get(JobConstants.PARAM_TOOL_NM);
        if (Util.isNullOrNil(toolnmPath)) {
            throw new TaskInitException(TAG + "---The path of tool 'nm' is not given!");
        } else {
            Pattern envPattern = Pattern.compile("(\\$[a-zA-Z_-]+)");
            Matcher matcher =  envPattern.matcher(toolnmPath);
            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)) {

View on GitHub (pinned to 3b8293bd65)