{"record":{"id":"eb3cbffdb96a990a","repo":"Tencent/matrix","slug":"apk-unzip-path-can-not-be-null-eb3cbf","errorCode":null,"errorMessage":"---APK-UNZIP-PATH can not be null!","messagePattern":"---APK-UNZIP-PATH can not be null!","errorType":"validation","errorClass":"TaskInitException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/MethodCountTask.java","lineNumber":85,"sourceCode":"    private final Map<String, Integer> pkgExternalMethod;\n\n    public MethodCountTask(JobConfig config, Map<String, String> params) {\n        super(config, params);\n        type = TASK_TYPE_COUNT_METHOD;\n        dexFileNameList = new ArrayList<String>();\n        dexFileList = new ArrayList<RandomAccessFile>();\n        classInternalMethod = new HashMap<String, Integer>();\n        classExternalMethod = new HashMap<String, Integer>();\n        pkgInternalRefMethod = new HashMap<String, Integer>();\n        pkgExternalMethod = new HashMap<String, Integer>();\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n        String inputPath = config.getUnzipPath();\n        if (Util.isNullOrNil(inputPath)) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH can not be null!\");\n        }\n        Log.i(TAG, \"input path:%s\", inputPath);\n        inputFile = new File(inputPath);\n        if (!inputFile.exists()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not exist!\");\n        } else if (!inputFile.isDirectory()) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH '\" + inputPath + \"' is not directory!\");\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                }","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/MethodCountTask.java#L67-L103","documentation":"MethodCountTask.init() validates its configuration before running the APK method-count analysis. It throws TaskInitException with this message when config.getUnzipPath() returns null or an empty string. The task needs the directory of the already-unzipped APK to find .dex files, so without a path it cannot proceed.","triggerScenarios":"Calling MethodCountTask (via Matrix APM checker job) with an ApkDetector/JobConfig whose unzip path was never set, or set to null/empty string, before task execution.","commonSituations":"Forgetting to call setUnzipPath()/configure the unzip step before the checker pipeline runs; a preceding unzip task failed silently leaving the path empty; programmatic configuration built from missing CLI/Gradle parameters.","solutions":["Set the unzip path on the job config (e.g. config.setUnzipPath(...)) pointing to the directory produced by unzipping the APK before running MethodCountTask.","Run/verify the APK unzip task completes first so the path is populated.","Check that upstream parameter plumbing (CLI args, JobConstants params) actually passes the path into the config."],"exampleFix":"// before\nJobConfig config = new JobConfig();\n// unzip path never set\n// after\nJobConfig config = new JobConfig();\nconfig.setUnzipPath(\"/tmp/build/apk-unzipped\");","handlingStrategy":"validation","validationCode":"if (config == null || config.getUnzipPath() == null || config.getUnzipPath().isEmpty()) {\n    throw new IllegalStateException(\"unzip path must be set before running MethodCountTask\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    task.init();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"can not be null\")) {\n        // abort pipeline: configuration is incomplete\n    }\n}","preventionTips":["Always call setUnzipPath() before adding tasks to the checker job.","Assert config completeness with a unit test for your pipeline setup.","Fail fast at job start: validate all required config fields once."],"tags":["config","init","apk-canary"],"backgroundTag":"missing-required-config-field","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"}