{"record":{"id":"106b61a4937c1525","repo":"Tencent/matrix","slug":"tag-apk-file-path-inputpath-is-ill","errorCode":null,"errorMessage":"TAG + \"---APK-FILE-PATH '\" + inputPath + \"' is illegal!\"","messagePattern":"TAG \\+ \"---APK-FILE-PATH '\" \\+ inputPath \\+ \"' is illegal!\"","errorType":"exception","errorClass":"TaskInitException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UncompressedFileTask.java","lineNumber":70,"sourceCode":"    private Map<String, Long> uncompressSizeMap;\n    private Map<String, Long> compressSizeMap;\n\n    public UncompressedFileTask(JobConfig config, Map<String, String> params) {\n        super(config, params);\n        type = TASK_TYPE_UNCOMPRESSED_FILE;\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n        String inputPath = config.getApkPath();\n\n        if (Util.isNullOrNil(inputPath)) {\n            throw new TaskInitException(TAG + \"---APK-FILE-PATH can not be null!\");\n        }\n        inputFile = new File(inputPath);\n        if (!FileUtil.isLegalFile(inputFile)) {\n            throw new TaskInitException(TAG + \"---APK-FILE-PATH '\" + inputPath + \"' is illegal!\");\n        }\n\n        filterSuffix = new HashSet<>();\n\n        if (params.containsKey(JobConstants.PARAM_SUFFIX) && !Util.isNullOrNil(params.get(JobConstants.PARAM_SUFFIX))) {\n            String[]  suffix = params.get(JobConstants.PARAM_SUFFIX).split(\",\");\n            for (String suffixStr : suffix) {\n                filterSuffix.add(suffixStr.trim());\n            }\n        }\n\n        uncompressSizeMap = new HashMap<>();\n        compressSizeMap = new HashMap<>();\n    }\n\n    private String getSuffix(String name) {\n        int index = name.indexOf('.');\n        if (index >= 0 && index < name.length() - 1) {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UncompressedFileTask.java#L52-L88","documentation":"Thrown from UncompressedFileTask.init() when the configured APK file path is empty, or the file exists but is not a legal/valid APK file per FileUtil.isLegalFile. The task analyzes compression of entries inside the APK itself (not an unzipped tree), so an invalid APK path fails init with TaskInitException.","triggerScenarios":"APK path points to a file that was never built, was cleaned, is a directory, or has a typo; running from a different working directory with a relative path.","commonSituations":"CI building later than check runs; relative path resolved against unexpected cwd; stale config pointing to an old build variant (e.g. app-debug.apk removed).","solutions":["Verify the file exists and is readable (ls -l) at the configured path before launching.","Use an absolute path, or resolve it against the correct working directory.","Rebuild the APK for the intended variant and update the config path.","Confirm you point at the .apk file itself, not an output directory."],"exampleFix":"// before\ncfg.setApkPath(\"app/build/outputs/apk/release/app-release.apk\"); // file absent\n// after\nFile apk = new File(projectDir, \"app/build/outputs/apk/release/app-release.apk\");\nif (!apk.isFile()) throw new IllegalStateException(\"Build APK first: \" + apk);\ncfg.setApkPath(apk.getAbsolutePath());","handlingStrategy":"validation","validationCode":"File apk = new File(apkPath);\nif (!apk.isFile() || !apk.canRead()) {\n    throw new IllegalStateException(\"APK file missing or unreadable: \" + apkPath);\n}","typeGuard":"boolean isLegalApk(File f) { return f != null && f.isFile() && f.canRead() && f.getName().endsWith(\".apk\"); }","tryCatchPattern":"try {\n    job.run();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"is illegal\")) {\n        log.error(\"APK path '{}' does not exist or is not a regular file; build the APK first\", apkPath);\n    } else throw e;\n}","preventionTips":["Generate the APK path from the build system rather than hard-coding it.","Verify the file exists right after the build, before analysis.","Use absolute paths or set the correct working directory.","Rebuild when switching build variants/debug releases."],"tags":["android","apk-canary","file-not-found","build"],"backgroundTag":"file-not-found","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"}