{"record":{"id":"dbda03e9c01e97e9","repo":"Tencent/tinker","slug":"can-not-parse-line-s","errorCode":null,"errorMessage":"can not parse line %s","messagePattern":"can not parse line (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"tinker-build/tinker-patch-cli/tool_output/merge_mapping.py","lineNumber":147,"sourceCode":"    @staticmethod\n    def get_name_and_complete_name_and_new_name(line):\n        \"\"\" ___ ___ -> ___\n            ___:___:___ ___(___) -> ___\n            ___:___:___ ___(___):___ -> ___\n            ___:___:___ ___(___):___:___ -> ___\n        \"\"\"\n        no_space_line = line.strip()\n        colonIndex1 = no_space_line.find(\":\")\n        colonIndex2 = no_space_line.find(\":\", colonIndex1+1) if colonIndex1 != -1 else -1\n        spaceIndex = no_space_line.find(\" \", colonIndex2+2)\n        argumentIndex1 = no_space_line.find(\"(\", spaceIndex+1)\n        argumentIndex2 = no_space_line.find(\")\", argumentIndex1+1) if argumentIndex1 != -1 else -1\n        colonIndex3 = no_space_line.find(\":\", argumentIndex2+1) if argumentIndex2 != -1 else -1\n        colonIndex4 = no_space_line.find(\":\", colonIndex3+1) if colonIndex3 != -1 else -1\n        arrowIndex = no_space_line.find(\"->\")\n\n        if spaceIndex < 0 or arrowIndex < 0:\n            raise Exception(\"can not parse line %s\", no_space_line)\n        name = no_space_line[spaceIndex + 1: argumentIndex1 if argumentIndex1 >= 0 else arrowIndex].strip()\n        new_name = no_space_line[arrowIndex + 2:].strip()\n        complete_name = no_space_line[colonIndex2 + 1:arrowIndex].strip()\n        return name, complete_name,  new_name\n\n    def print_new_mapping(self):\n        output_path = os.path.join(os.getcwd(), \"new_mapping.txt\")\n        with open(output_path, \"w\") as fw:\n            for key in self.current_class_list:\n                if key in self.current_classes:\n                    data = self.current_classes[key]\n                    fw.write(data.raw_line)\n                    for line in data.field_methods:\n                        fw.write(line)\n\n\nif __name__ == '__main__':\n    DealWithProguardWarning().exe(sys.argv[1:])","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-build/tinker-patch-cli/tool_output/merge_mapping.py#L129-L165","documentation":"Raised by the line parser in merge_mapping.py (line 147) while reading a mapping file. The parser tokenizes a proguard mapping line by locating the first space and the '->' arrow; a member line looks like '    int field -> a' or '    java.lang.String method(int) -> b'. If either spaceIndex or arrowIndex is -1 (line 152 region: 'if spaceIndex < 0 or arrowIndex < 0'), the line is not recognizable proguard mapping syntax and the script aborts. Practically this fires on garbage input: feeding the wrong file (usage.txt, seeds, a config), a file with different formatting, or text with no '->' at all.","triggerScenarios":"Passing a file that is not a proguard/R8 mapping.txt as either argument: e.g. proguard usage.txt, mapping from a non-proguard tool, a GZIP-compressed or CRLF-mangled mapping, or a hand-edited file where a member line lost its leading space/indentation or the '->' separator.","commonSituations":"Mixing up output files when automating the applymapping merge flow; CI artifacts renamed so usage.txt lands where mapping.txt was expected; mappings written by newer R8 versions with unusual lines; editing mapping files manually to resolve warnings and breaking syntax.","solutions":["Confirm each input is a genuine proguard mapping: lines must contain 'original -> obfuscated' with member lines indented by a space.","If you edited a mapping, restore the ' -> ' separator and the leading indentation on member lines.","Re-generate the file from a clean minified build instead of using leftovers from other proguard outputs.","Sanity-check before running: grep -c ' -> ' mapping.txt should be roughly the number of non-blank lines."],"exampleFix":"# before (member line broken — no arrow, no indent)\nint count b\n\n# after\n    int count -> b","handlingStrategy":"validation","validationCode":"# pre-check the input before running the tool\nimport sys\nfor path in sys.argv[1:3]:\n    bad = [l.rstrip('\\n') for l in open(path) if l.strip() and not l.strip().startswith('#') and '->' not in l]\n    if bad:\n        sys.exit('%s is not a proguard mapping (first bad line: %r)' % (path, bad[0]))","typeGuard":"def looks_like_mapping_line(line):\n    s = line.strip()\n    return s == '' or s.startswith('#') or ' -> ' in s or ' ->' in s","tryCatchPattern":"try:\n    tool.exe(args)\nexcept Exception as e:\n    if 'can not parse line' in str(e):\n        sys.exit('input is not a valid proguard mapping — regenerate mapping.txt from a minified build')\n    raise","preventionTips":["Feed only machine-generated proguard mapping files to the tool; never hand-edited ones.","Do not pass other proguard outputs (usage.txt, seeds.txt) as mappings.","Spot-check with grep -c ' -> ' mapping.txt before running the merge."],"tags":["python","proguard","mapping","parsing","cli"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}