{"record":{"id":"2c2e593184bbc523","repo":"Tencent/tinker","slug":"mapping-file-is-not-exist-path-s","errorCode":null,"errorMessage":"mapping file is not exist, path=%s","messagePattern":"mapping file is not exist, path=(.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"tinker-build/tinker-patch-cli/tool_output/merge_mapping.py","lineNumber":84,"sourceCode":"                    # 方法的处理，直接加进去\n                    current_mapping_data.field_methods.append(line)\n            classes[current_mapping_data.key] = current_mapping_data\n            class_list.append(current_mapping_data.key)\n        print \"size: \", len(classes)\n\n    def remove_warning_mapping(self, old_mapping, current_mapping):\n        self.read_mapping_file(self.classes, self.class_list, old_mapping)\n        self.read_mapping_file(self.current_classes, self.current_class_list, current_mapping)\n        self.do_merge()\n        self.print_new_mapping()\n\n    def exe(self, args):\n        if len(args) < 2:\n            print_usage()\n\n        old_mapping_path = args[0]\n        if not os.path.exists(old_mapping_path):\n            raise Exception(\"mapping file is not exist, path=%s\", old_mapping_path)\n\n        current_mapping_path = args[1]\n        if not os.path.exists(current_mapping_path):\n            raise Exception(\"proguard warning file is not exist, path=%s\", current_mapping_path)\n\n        self.remove_warning_mapping(old_mapping_path, current_mapping_path)\n\n    def do_merge(self):\n        # 遍历当前的mapping class_key\n        for key in self.current_class_list:\n            if key in self.classes:\n                data = self.classes[key]\n                current_data = self.current_classes[key]\n                # 如果当前的类没有被混淆，则保留，否则用之前的mapping里面的内容覆盖\n                # ___.___ -> ___.___:\n                if current_data.raw_line.split(\"->\")[0] != current_data.raw_line.split(\"->\")[1][:-1]:\n                    current_data.raw_line = data.raw_line\n                new_method_list = []","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-build/tinker-patch-cli/tool_output/merge_mapping.py#L66-L102","documentation":"Raised by DealWithProguardWarning.exe() in tinker-build/tinker-patch-cli/tool_output/merge_mapping.py (line 84) when args[0] — the old (previous release) proguard mapping.txt — does not exist on disk. This script merges last version's mapping with the current build's mapping to produce new_mapping.txt in the CWD (the applymapping conflict workflow described in the module docstring). Note the Python-2 style bug: raise Exception(\"...path=%s\", old_mapping_path) passes the path as a second Exception arg instead of formatting it, so the printed message shows the literal '%s'.","triggerScenarios":"Running 'python merge_mapping.py old_mapping.txt current_mapping.txt' where old_mapping.txt does not exist: wrong relative path (script resolves nothing — the path is used verbatim by os.path.exists), the file is still named differently (mapping.txt from another build dir), or the previous release's mapping was never copied/saved.","commonSituations":"Automating patch builds where the baseline mapping lives in a CI artifact directory passed with a typo or wrong working directory; the old mapping is in the APK's build/outputs/mapping/release directory that was cleaned; first-time use of the tool without a previous mapping.","solutions":["Verify the exact path before running: ls -l <old_mapping> from the same directory you invoke the script from.","Point args[0] at the baseline build's build/outputs/mapping/release/mapping.txt (copy it somewhere durable after each release).","Use absolute paths in your wrapper script to avoid CWD-relative mismatch.","If you maintain the tool, format the message properly: raise Exception(\"mapping file is not exist, path=%s\" % old_mapping_path)."],"exampleFix":"# before\npython merge_mapping.py mapping_old.txt current_mapping.txt   # mapping_old.txt absent\n\n# after\npython merge_mapping.py /abs/path/to/base-apk-mapping.txt ./current_mapping.txt","handlingStrategy":"validation","validationCode":"# shell wrapper before invoking merge_mapping.py\nOLD_MAP=\"$1\"; [ -f \"$OLD_MAP\" ] || { echo \"old mapping missing: $OLD_MAP\"; exit 1; }\npython merge_mapping.py \"$OLD_MAP\" \"$CUR_MAP\"","typeGuard":"def is_proguard_mapping(path):\n    import os\n    return os.path.isfile(path)","tryCatchPattern":"try:\n    merge.exe(sys.argv[1:])\nexcept Exception as e:\n    if 'mapping file is not exist' in str(e):\n        sys.exit('baseline mapping not found — archive mapping.txt after every release')\n    raise","preventionTips":["Archive each release's build/outputs/mapping/release/mapping.txt to a durable location immediately after building.","Use absolute paths for both mapping arguments.","Note the '%s' in the message is never filled in — echo the paths yourself in the wrapper."],"tags":["python","proguard","mapping","cli","file-not-found","patch-build"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}