Tencent/tinker · error · Exception

mapping file is not exist, path=%s

Error message

mapping file is not exist, path=%s

What it means

Raised by RemoveProguardWarning.do_command() in proguard_warning.py (line 98) when args[0] — the proguard mapping.txt — does not exist. The tool then reads the mapping, and for each 'Warning:' line in args[1] removes the offending members. As with the sibling scripts, the message's '%s' placeholder is never interpolated because the path is passed as an extra Exception argument (Python 2 idiom misuse), so the user sees the literal format string without the offending path.

Source

Thrown at tinker-build/tinker-patch-cli/tool_output/proguard_warning.py:98

        with open(output_path, "w") as fw:
            for key in self.class_list:
                if key in self.classes:
                    data = self.classes[key]
                    fw.write(data.raw_line)
                    for line in data.filed_methods:
                        fw.write(line)

    def remove_warning_mapping(self, mapping, warning):
        self.read_mapping_file(mapping)
        self.remove_warning(warning)

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

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

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

        self.remove_warning_mapping(mapping_path, warning_patch)



if __name__ == '__main__':
    RemoveProguardWarning().do_command(sys.argv[1:])

View on GitHub (pinned to 1b7ea02c23)

Solutions

  1. Locate the real mapping: look under <module>/build/outputs/mapping/release/mapping.txt after a minified build.
  2. Pass an absolute path for args[0].
  3. Assert existence in the wrapper before calling: test -f "$MAP" || { echo "missing $MAP"; exit 1; }.
  4. Fix the formatting bug if you own the script: raise Exception("mapping file is not exist, path=%s" % mapping_path).

Example fix

# before
python proguard_warning.py mapping.txt warnings.txt  # mapping.txt not in CWD

# after
python proguard_warning.py "$APP_ROOT/app/build/outputs/mapping/release/mapping.txt" warnings.txt
Defensive patterns

Strategy: validation

Validate before calling

import os, sys
mapping = sys.argv[1]
if not os.path.isfile(mapping):
    sys.exit('mapping not found: %s — expected <module>/build/outputs/mapping/release/mapping.txt' % mapping)

Try / catch

try:
    RemoveProguardWarning().do_command(sys.argv[1:])
except Exception as e:
    if 'mapping file is not exist' in str(e):
        sys.exit('supply a valid mapping.txt path and rerun')
    raise

Prevention

When it happens

Trigger: Invoking 'python proguard_warning.py <mapping> <warnings>' where the mapping path is mistyped, relative to the wrong CWD, or the mapping file was never produced (build without minifyEnabled, or build/ cleaned) or lives in a different module's outputs directory.

Common situations: CI automation computing the mapping path from variables that are empty on some branches; developers running the tool from the repo root while the mapping sits under app/build/outputs/mapping/release/; renaming artifacts between proguard versions.

Related errors


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