{"record":{"id":"209166b0a7ffb171","repo":"Tencent/tinker","slug":"resource-file-md5-mismatch-but-patch-resource-fil-209166","errorCode":null,"errorMessage":"resource file md5 mismatch, but patch resource file not found!","messagePattern":"resource file md5 mismatch, but patch resource file not found!","errorType":"exception","errorClass":"TinkerRuntimeException","httpStatus":null,"severity":"error","filePath":"tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java","lineNumber":310,"sourceCode":"                    ShareTinkerLog.e(TAG, \"patch resource file directory not found, warning why the path is null!!!!\");\n                    throw new TinkerRuntimeException(\"patch resource file directory not found, warning why the path is null!!!!\");\n                }\n                break;\n            case ShareConstants.ERROR_LOAD_PATCH_VERSION_RESOURCE_FILE_NOT_EXIST:\n                if (patchVersionDirectory != null) {\n                    ShareTinkerLog.e(TAG, \"patch resource file not found:%s\", resourceFile.getAbsolutePath());\n                    tinker.getLoadReporter().onLoadFileNotFound(resourceFile,\n                        ShareConstants.TYPE_RESOURCE, false);\n                } else {\n                    //should be not here\n                    ShareTinkerLog.e(TAG, \"patch resource file not found, warning why the path is null!!!!\");\n                    throw new TinkerRuntimeException(\"patch resource file not found, warning why the path is null!!!!\");\n                }\n                break;\n            case ShareConstants.ERROR_LOAD_PATCH_VERSION_RESOURCE_MD5_MISMATCH:\n                if (resourceFile == null) {\n                    ShareTinkerLog.e(TAG, \"resource file md5 mismatch, but patch resource file not found!\");\n                    throw new TinkerRuntimeException(\"resource file md5 mismatch, but patch resource file not found!\");\n                }\n                ShareTinkerLog.e(TAG, \"patch resource file md5 is mismatch: %s\", resourceFile.getAbsolutePath());\n\n                tinker.getLoadReporter().onLoadFileMd5Mismatch(resourceFile,\n                    ShareConstants.TYPE_RESOURCE);\n                break;\n            case ShareConstants.ERROR_LOAD_PATCH_GET_OTA_INSTRUCTION_SET_EXCEPTION:\n                tinker.getLoadReporter().onLoadInterpret(ShareConstants.TYPE_INTERPRET_GET_INSTRUCTION_SET_ERROR, ShareIntentUtil.getIntentInterpretException(intentResult));\n                break;\n            case ShareConstants.ERROR_LOAD_PATCH_OTA_INTERPRET_ONLY_EXCEPTION:\n                tinker.getLoadReporter().onLoadInterpret(ShareConstants.TYPE_INTERPRET_COMMAND_ERROR, ShareIntentUtil.getIntentInterpretException(intentResult));\n                break;\n            case ShareConstants.ERROR_LOAD_OK:\n                ShareTinkerLog.i(TAG, \"oh yeah, tinker load all success\");\n                tinker.setTinkerLoaded(true);\n                // get load dex\n                dexes = ShareIntentUtil.getIntentPatchDexPaths(intentResult);\n                libs = ShareIntentUtil.getIntentPatchLibsPaths(intentResult);","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java#L292-L328","documentation":"In the ERROR_LOAD_PATCH_VERSION_RESOURCE_MD5_MISMATCH branch, TinkerLoadResult first checks that resourceFile is non-null before reporting onLoadFileMd5Mismatch. The resource file's content no longer matches the MD5 recorded in patch metadata, and additionally the file object is null, so Tinker throws instead of reporting. Primary cause is the patched resources archive being altered/truncated; the null file is the secondary invariant break.","triggerScenarios":"Loader detects resources MD5 mismatch and returns ERROR_LOAD_PATCH_VERSION_RESOURCE_MD5_MISMATCH while resourceFile (the versioned resources_out file) resolves to null.","commonSituations":"Corrupted or partially written resources patch on disk; file removed between check and report; storage issues on low-end devices; component version mismatch.","solutions":["cleanPatch() then re-install the patch.","Enable tinkerLoadVerify only when needed and verify patch md5 before apply so corrupt patches are rejected earlier.","Keep patch files on internal storage; avoid applying patches while storage is nearly full.","Align tinker versions."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"TinkerLoadResult r = tinker.getTinkerLoadResultIfPresent();\nif (r != null && r.resourceFile != null && !r.resourceFile.exists()) {\n    tinker.cleanPatch();\n}","typeGuard":null,"tryCatchPattern":"catch (TinkerRuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"resource file md5 mismatch\")) {\n        Tinker.with(app).cleanPatch();\n    } else throw e;\n}","preventionTips":["Validate patch archive integrity before apply","Avoid applying patches when storage is nearly full"],"tags":["tinker","hotpatch","android","resource","md5","integrity"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}