Tencent/tinker · error · Exception

proguard warning file is not exist, path=%s

Error message

proguard warning file is not exist, path=%s

What it means

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).

Source

Thrown at tinker-build/tinker-patch-cli/tool_output/merge_mapping.py:88

        print "size: ", len(classes)

    def remove_warning_mapping(self, old_mapping, current_mapping):
        self.read_mapping_file(self.classes, self.class_list, old_mapping)
        self.read_mapping_file(self.current_classes, self.current_class_list, current_mapping)
        self.do_merge()
        self.print_new_mapping()

    def exe(self, args):
        if len(args) < 2:
            print_usage()

        old_mapping_path = args[0]
        if not os.path.exists(old_mapping_path):
            raise Exception("mapping file is not exist, path=%s", old_mapping_path)

        current_mapping_path = args[1]
        if not os.path.exists(current_mapping_path):
            raise Exception("proguard warning file is not exist, path=%s", current_mapping_path)

        self.remove_warning_mapping(old_mapping_path, current_mapping_path)

    def do_merge(self):
        # 遍历当前的mapping class_key
        for key in self.current_class_list:
            if key in self.classes:
                data = self.classes[key]
                current_data = self.current_classes[key]
                # 如果当前的类没有被混淆,则保留,否则用之前的mapping里面的内容覆盖
                # ___.___ -> ___.___:
                if current_data.raw_line.split("->")[0] != current_data.raw_line.split("->")[1][:-1]:
                    current_data.raw_line = data.raw_line
                new_method_list = []
                # 处理方法
                for line in current_data.field_methods:
                    result, new_line = self.find_same_methods(line, data)
                    # 只有找到才写入

View on GitHub (pinned to 1b7ea02c23)

Solutions

  1. Build the current version with minification first so its mapping.txt exists, then pass its absolute path as args[1].
  2. Check argument order against the usage string: old_mapping.txt first, current_mapping.txt second.
  3. Add an existence assertion in your wrapper (test -f "$CUR_MAP" || exit 1) before calling the script.
  4. Fix message formatting if you maintain the tool: raise Exception("proguard warning file is not exist, path=%s" % current_mapping_path).

Example fix

# before
python merge_mapping.py old_mapping.txt curr/mapping.txt  # curr/mapping.txt not built yet

# after
./gradlew :app:assembleRelease  # generates current mapping
python merge_mapping.py old_mapping.txt app/build/outputs/mapping/release/mapping.txt
Defensive patterns

Strategy: validation

Validate before calling

import os, sys
old, cur = sys.argv[1], sys.argv[2]
for label, p in (('old', old), ('current', cur)):
    if not os.path.exists(p):
        sys.exit('%s mapping missing: %s' % (label, p))

Try / catch

try:
    DealWithProguardWarning().exe(args)
except Exception as e:
    if 'not exist' in str(e):
        print('check both mapping paths and rerun'); sys.exit(2)
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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].

Related errors


AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14). Data as JSON: /api/errors/4fbbf374fc4cf5e5. Report an issue: GitHub.