Tencent/tinker · error · TinkerRuntimeException

patch resource file not found, warning why the path is null!

Error message

patch resource file not found, warning why the path is null!!!!

What it means

Twin of 147 for a single resource file: ERROR_LOAD_PATCH_VERSION_RESOURCE_FILE_NOT_EXIST should report the missing resources file via onLoadFileNotFound(resourceFile, TYPE_RESOURCE, false), but when patchVersionDirectory is null the path cannot be derived and Tinker throws TinkerRuntimeException. It indicates the versioned patch directory metadata became inconsistent with the loader's inspection result.

Source

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

                if (patchVersionDirectory != null) {
                    ShareTinkerLog.e(TAG, "patch resource file directory not found:%s", resourceDirectory.getAbsolutePath());
                    tinker.getLoadReporter().onLoadFileNotFound(resourceDirectory,
                        ShareConstants.TYPE_RESOURCE, true);
                } else {
                    //should be not here
                    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;

View on GitHub (pinned to 1b7ea02c23)

Solutions

  1. cleanPatch() and re-apply the patch.
  2. Avoid concurrent patch operations across processes.
  3. Validate no cleanup service deletes files under /tinker/.
  4. Reproduce with tinker logs enabled to see the exact load sequence.
Defensive patterns

Strategy: try-catch

Try / catch

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

Prevention

When it happens

Trigger: Loader returns ERROR_LOAD_PATCH_VERSION_RESOURCE_FILE_NOT_EXIST with patchVersionDirectory null locally (patch info references a version whose directory cannot be resolved).

Common situations: resources_out.zip in the version directory deleted after apply; patch info corruption; concurrent cleanPatch during load.

Related errors


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