{"record":{"id":"c8c626f351412c00","repo":"Tencent/tinker","slug":"res-meta-corrupted","errorCode":null,"errorMessage":"res meta Corrupted:{}","messagePattern":"res meta Corrupted:(.+?)","errorType":"exception","errorClass":"TinkerRuntimeException","httpStatus":null,"severity":"critical","filePath":"tinker-android/tinker-android-loader-no-op/src/main/java/com/tencent/tinker/loader/shareutil/ShareResPatchInfo.java","lineNumber":161,"sourceCode":"        if (input.contains(\"?\")) {\n            input = input.replaceAll(\"\\\\?\", \"\\\\.\");\n        }\n        //convert * to.*\n        if (input.contains(\"*\")) {\n            input = input.replace(\"*\", \".*\");\n        }\n        Pattern pattern = Pattern.compile(input);\n        return pattern;\n    }\n\n    public static void parseResPatchInfoFirstLine(String meta, ShareResPatchInfo info) {\n        if (meta == null || meta.length() == 0) {\n            return;\n        }\n        String[] lines = meta.split(\"\\n\");\n        String firstLine = lines[0];\n        if (firstLine == null || firstLine.length() <= 0) {\n            throw new TinkerRuntimeException(\"res meta Corrupted:\" + meta);\n        }\n        final String[] kv = firstLine.split(\",\", 3);\n        info.arscBaseCrc = kv[1];\n        info.resArscMd5 = kv[2];\n    }\n\n    @Override\n    public String toString() {\n        StringBuffer sb = new StringBuffer();\n        sb.append(\"resArscMd5:\" + resArscMd5 + \"\\n\");\n        sb.append(\"arscBaseCrc:\" + arscBaseCrc + \"\\n\");\n\n        for (Pattern pattern : patterns) {\n            sb.append(\"pattern:\" + pattern + \"\\n\");\n        }\n        for (String add : addRes) {\n            sb.append(\"addedSet:\" + add + \"\\n\");\n        }","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-loader-no-op/src/main/java/com/tencent/tinker/loader/shareutil/ShareResPatchInfo.java#L143-L179","documentation":"ShareResPatchInfo.parseResPatchInfoFirstLine parses the first line of the res-meta entry from the patch's meta file. It splits the first line on ',' with limit 3 and assigns kv[1] to arscBaseCrc and kv[2] to resArscMd5. If the meta is non-null but its first line is empty, TinkerRuntimeException('res meta Corrupted:<meta>') is thrown — the resource-patch metadata cannot be interpreted. (Note: fewer than 3 comma-separated parts would instead surface as ArrayIndexOutOfBoundsException.)","triggerScenarios":"meta string whose first line (before the first \\n) is empty — e.g. a leading newline in the res entry of meta.txt; a res-meta line built by a mismatched/old patch-build tool; manual editing of the package breaking the 'res,' prefix line format.","commonSituations":"Patch built with an old tinker gradle plugin but loaded with a newer loader (or vice versa); corrupted patch download; resource-only patches where the res meta line was malformed during packaging.","solutions":["Rebuild the patch with the tinker gradle plugin version matching the loader SDK, and verify the meta.txt res line starts with the expected 'res,<crc>,<md5>' triple.","Validate the patch package (md5 of the whole zip) before applying so corrupted downloads never reach parsing.","If you construct the meta string yourself, ensure line 1 is the non-empty header line and later lines carry the entries.","Upgrade both tinker gradle plugin and android SDK together from the same release."],"exampleFix":"// before\ninfo.arscBaseCrc = kv[1];\ninfo.resArscMd5 = kv[2];\n\n// after\nfinal String[] kv = firstLine.split(\",\", 3);\nif (kv.length < 3) {\n    throw new TinkerRuntimeException(\"res meta Corrupted:\" + meta);\n}\ninfo.arscBaseCrc = kv[1];\ninfo.resArscMd5 = kv[2];","handlingStrategy":"validation","validationCode":"String[] parts = firstLine == null ? null : firstLine.split(\",\", 3);\nif (parts == null || parts.length < 3 || firstLine.isEmpty()) {\n    // refuse to parse: malformed res meta\n}","typeGuard":null,"tryCatchPattern":"catch TinkerRuntimeException 'res meta Corrupted' -> reject the patch package and request a rebuilt one","preventionTips":["Build patches with gradle plugin and loader SDK from the same tinker release.","Verify patch zip md5 before apply so corrupted meta never reaches the parser.","Never hand-edit or re-zip patch packages after signing."],"tags":["resource-patch","meta","parsing","patch-package"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}