Tencent/tinker · error · TinkerRuntimeException

resource file md5 mismatch, but patch resource file not foun

Error message

resource file md5 mismatch, but patch resource file not found!

What it means

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.

Source

Thrown at tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java:310

                    ShareTinkerLog.e(TAG, "patch resource file directory not found, warning why the path is null!!!!");
                    throw new TinkerRuntimeException("patch resource file directory not found, warning why the path is null!!!!");
                }
                break;
            case ShareConstants.ERROR_LOAD_PATCH_VERSION_RESOURCE_FILE_NOT_EXIST:
                if (patchVersionDirectory != null) {
                    ShareTinkerLog.e(TAG, "patch resource file not found:%s", resourceFile.getAbsolutePath());
                    tinker.getLoadReporter().onLoadFileNotFound(resourceFile,
                        ShareConstants.TYPE_RESOURCE, false);
                } else {
                    //should be not here
                    ShareTinkerLog.e(TAG, "patch resource file not found, warning why the path is null!!!!");
                    throw new TinkerRuntimeException("patch resource file not found, warning why the path is null!!!!");
                }
                break;
            case ShareConstants.ERROR_LOAD_PATCH_VERSION_RESOURCE_MD5_MISMATCH:
                if (resourceFile == null) {
                    ShareTinkerLog.e(TAG, "resource file md5 mismatch, but patch resource file not found!");
                    throw new TinkerRuntimeException("resource file md5 mismatch, but patch resource file not found!");
                }
                ShareTinkerLog.e(TAG, "patch resource file md5 is mismatch: %s", resourceFile.getAbsolutePath());

                tinker.getLoadReporter().onLoadFileMd5Mismatch(resourceFile,
                    ShareConstants.TYPE_RESOURCE);
                break;
            case ShareConstants.ERROR_LOAD_PATCH_GET_OTA_INSTRUCTION_SET_EXCEPTION:
                tinker.getLoadReporter().onLoadInterpret(ShareConstants.TYPE_INTERPRET_GET_INSTRUCTION_SET_ERROR, ShareIntentUtil.getIntentInterpretException(intentResult));
                break;
            case ShareConstants.ERROR_LOAD_PATCH_OTA_INTERPRET_ONLY_EXCEPTION:
                tinker.getLoadReporter().onLoadInterpret(ShareConstants.TYPE_INTERPRET_COMMAND_ERROR, ShareIntentUtil.getIntentInterpretException(intentResult));
                break;
            case ShareConstants.ERROR_LOAD_OK:
                ShareTinkerLog.i(TAG, "oh yeah, tinker load all success");
                tinker.setTinkerLoaded(true);
                // get load dex
                dexes = ShareIntentUtil.getIntentPatchDexPaths(intentResult);
                libs = ShareIntentUtil.getIntentPatchLibsPaths(intentResult);

View on GitHub (pinned to 1b7ea02c23)

Solutions

  1. cleanPatch() then re-install the patch.
  2. Enable tinkerLoadVerify only when needed and verify patch md5 before apply so corrupt patches are rejected earlier.
  3. Keep patch files on internal storage; avoid applying patches while storage is nearly full.
  4. Align tinker versions.
Defensive patterns

Strategy: validation

Validate before calling

TinkerLoadResult r = tinker.getTinkerLoadResultIfPresent();
if (r != null && r.resourceFile != null && !r.resourceFile.exists()) {
    tinker.cleanPatch();
}

Try / catch

catch (TinkerRuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("resource file md5 mismatch")) {
        Tinker.with(app).cleanPatch();
    } else throw e;
}

Prevention

When it happens

Trigger: Loader detects resources MD5 mismatch and returns ERROR_LOAD_PATCH_VERSION_RESOURCE_MD5_MISMATCH while resourceFile (the versioned resources_out file) resolves to null.

Common situations: Corrupted or partially written resources patch on disk; file removed between check and report; storage issues on low-end devices; component version mismatch.

Related errors


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