{"record":{"id":"1c740078861393c4","repo":"Tencent/matrix","slug":"mapping-file-config-getmappingfilepath-is-n","errorCode":null,"errorMessage":"---mapping file <config.getMappingFilePath()> is not legal!","messagePattern":"---mapping file <config\\.getMappingFilePath\\(\\)> is not legal!","errorType":"exception","errorClass":"TaskInitException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnzipTask.java","lineNumber":99,"sourceCode":"        super.init();\n        if (Util.isNullOrNil(config.getApkPath())) {\n            throw new TaskInitException(TAG + \"---APK-FILE-PATH can not be null!\");\n        }\n        Log.i(TAG, \"inputPath:%s\", config.getApkPath());\n        inputFile = new File(config.getApkPath());\n        if (!inputFile.exists()) {\n            throw new TaskInitException(TAG + \"---'\" + config.getApkPath() + \"' is not exist!\");\n        }\n        if (Util.isNullOrNil(config.getUnzipPath())) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH can not be null!\");\n        }\n        Log.i(TAG, \"outputPath:%s\", config.getUnzipPath());\n        outputFile = new File(config.getUnzipPath());\n\n        if (!Util.isNullOrNil(config.getMappingFilePath())) {\n            mappingTxt = new File(config.getMappingFilePath());\n            if (!FileUtil.isLegalFile(mappingTxt)) {\n                throw new TaskInitException(TAG + \"---mapping file \" + config.getMappingFilePath() + \" is not legal!\");\n            }\n        }\n\n        if (!Util.isNullOrNil(config.getResMappingFilePath())) {\n            resMappingTxt = new File(config.getResMappingFilePath());\n            if (!FileUtil.isLegalFile(resMappingTxt)) {\n                throw new TaskInitException(TAG + \"---resguard mapping file \" + config.getResMappingFilePath() + \" is not legal!\");\n            }\n        }\n    }\n\n    private void readMappingTxtFile() throws IOException {\n        if (mappingTxt != null) {\n            BufferedReader bufferedReader = new BufferedReader(new FileReader(mappingTxt));\n            String line = bufferedReader.readLine();\n            String beforeClass = \"\", afterClass = \"\";\n            try {\n                while (line != null) {","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnzipTask.java#L81-L117","documentation":"UnzipTask.init() validates the optional ProGuard mapping file: if config.getMappingFilePath() is set, the file must exist and be a regular, readable file (FileUtil.isLegalFile). Otherwise TaskInitException is thrown with the configured path in the message (shown as <config.getMappingFilePath()>).","triggerScenarios":"Setting a non-null/non-empty mappingFilePath that points to a missing, deleted, or directory path instead of a legal mapping txt file.","commonSituations":"Stale path after a clean build removed mapping.txt; pointing at the wrong module's mapping; path given but app was not built with minification so mapping.txt was never produced.","solutions":["Check the path in the message exists and is a regular readable file (not a directory).","Point mappingFilePath at the fresh mapping.txt from the same release build (e.g. app/build/outputs/mapping/release/mapping.txt).","If you don't need ProGuard mapping analysis, leave mappingFilePath unset (null) rather than passing a bad path."],"exampleFix":"// before\nconfig.setMappingFilePath(\"old/path/mapping.txt\"); // stale\n// after\nFile mapping = new File(\"app/build/outputs/mapping/release/mapping.txt\");\nif (mapping.isFile()) config.setMappingFilePath(mapping.getAbsolutePath());","handlingStrategy":"validation","validationCode":"String p = config.getMappingFilePath();\nif (p != null && !p.isEmpty()) {\n    File f = new File(p);\n    if (!f.isFile() || !f.canRead()) {\n        throw new IllegalArgumentException(\"mapping.txt not readable: \" + p);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    task.init();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"mapping file\")) {\n        logger.warn(\"Skipping mapping validation, bad mapping path\");\n        config.setMappingFilePath(null); // or fix path and retry\n    } else throw e;\n}","preventionTips":["Resolve mapping.txt from the build outputs of the same build, not a hardcoded path.","Only set the mapping path when the file was actually produced (minifyEnabled true).","Clean stale mapping files as part of the check task's inputs/outputs declaration."],"tags":["apk-canary","mapping-file","invalid-path","configuration"],"backgroundTag":"invalid-config-value","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"}