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 do_command() in proguard_warning.py (line 102) when args[1] — the proguard warnings file — does not exist. This is the second of the two sequential existence checks (mapping first at line 98, warnings second here), so reaching it means the mapping path was valid but the warnings file path is not. The unformatted '%s' again hides the actual path in the message.

Source

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

                    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. Generate the warnings file first: build with -applymapping old_mapping.txt and save proguard's Warning: output to a file.
  2. Verify the path with ls before invoking, and prefer absolute paths.
  3. Make your wrapper fail fast: test -f "$WARN" || { echo "missing $WARN"; exit 1; }.
  4. Fix message interpolation if you maintain the tool: raise Exception("proguard warning file is not exist, path=%s" % warning_patch).

Example fix

# before
python proguard_warning.py mapping.txt warnings.txt  # warnings.txt never created

# after
./gradlew assembleRelease 2> proguard_err.txt ; grep '^Warning:' proguard_err.txt > warnings.txt
python proguard_warning.py mapping.txt warnings.txt
Defensive patterns

Strategy: validation

Validate before calling

import os, sys
mapping, warnings = sys.argv[1], sys.argv[2]
for p in (mapping, warnings):
    if not os.path.isfile(p):
        sys.exit('missing input file: %s' % p)

Try / catch

try:
    RemoveProguardWarning().do_command(args)
except Exception as e:
    if 'warning file is not exist' in str(e):
        sys.exit('generate warnings.txt from a -applymapping build (grep ^Warning:) and rerun')
    raise

Prevention

When it happens

Trigger: Running the tool with a warnings path that is wrong: the proguard warning capture step was skipped (no build run with -applymapping yet), the file name is misspelled, or a relative path resolves against a different working directory than assumed.

Common situations: Scripted applymapping-conflict workflows where the warning-capture stage failed silently earlier in the pipeline; local runs from a different directory than the one where warnings.txt was written; CI artifacts not downloaded before the patch step.

Related errors


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