{"record":{"id":"4fbbf374fc4cf5e5","repo":"Tencent/tinker","slug":"proguard-warning-file-is-not-exist-path-s","errorCode":null,"errorMessage":"proguard warning file is not exist, path=%s","messagePattern":"proguard warning 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":88,"sourceCode":"        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 = []\n                # 处理方法\n                for line in current_data.field_methods:\n                    result, new_line = self.find_same_methods(line, data)\n                    # 只有找到才写入","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-build/tinker-patch-cli/tool_output/merge_mapping.py#L70-L106","documentation":"Raised by the same exe() in merge_mapping.py (line 88) when args[1] — the current build's mapping (the message calls it the 'proguard warning file') — does not exist. Per the module docstring, args[1] is the mapping produced by compiling the current project WITHOUT applymapping; the tool intersects it with the old mapping to emit new_mapping.txt. The '%s' is again not interpolated (Python 2 tuple-style Exception args).","triggerScenarios":"Invoking 'python merge_mapping.py old.txt current.txt' where the current mapping path is wrong or the file has not been generated yet — e.g. the current build with minifyEnabled was never run, so build/outputs/mapping/release/mapping.txt does not exist, or a relative path is resolved against an unexpected CWD.","commonSituations":"Running the merge step before producing a fresh minified build; clean-ing build/ between builds; CI pipelines that compute the current mapping path from a variable that is empty/unset; passing the two arguments in the wrong order so the missing one is args[1].","solutions":["Build the current version with minification first so its mapping.txt exists, then pass its absolute path as args[1].","Check argument order against the usage string: old_mapping.txt first, current_mapping.txt second.","Add an existence assertion in your wrapper (test -f \"$CUR_MAP\" || exit 1) before calling the script.","Fix message formatting if you maintain the tool: raise Exception(\"proguard warning file is not exist, path=%s\" % current_mapping_path)."],"exampleFix":"# before\npython merge_mapping.py old_mapping.txt curr/mapping.txt  # curr/mapping.txt not built yet\n\n# after\n./gradlew :app:assembleRelease  # generates current mapping\npython merge_mapping.py old_mapping.txt app/build/outputs/mapping/release/mapping.txt","handlingStrategy":"validation","validationCode":"import os, sys\nold, cur = sys.argv[1], sys.argv[2]\nfor label, p in (('old', old), ('current', cur)):\n    if not os.path.exists(p):\n        sys.exit('%s mapping missing: %s' % (label, p))","typeGuard":null,"tryCatchPattern":"try:\n    DealWithProguardWarning().exe(args)\nexcept Exception as e:\n    if 'not exist' in str(e):\n        print('check both mapping paths and rerun'); sys.exit(2)\n    raise","preventionTips":["Always build the current version with minifyEnabled true before the merge step so its mapping exists.","Keep argument order straight: old mapping first, current mapping second.","Fail fast in wrappers with test -f checks instead of relying on the tool's error messages."],"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-15T22:17:37.221Z"}