{"record":{"id":"30226e64003a149d","repo":"Tencent/tinker","slug":"patch-resource-file-directory-not-found-warning-w-30226e","errorCode":null,"errorMessage":"patch resource file directory not found, warning why the path is null!!!!","messagePattern":"patch resource file directory not found, warning why the path is null!!!!","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":293,"sourceCode":"                } else {\n                    ShareTinkerLog.e(TAG, \"patch dex file md5 is mismatch: %s\", mismatchPath);\n                    tinker.getLoadReporter().onLoadFileMd5Mismatch(new File(mismatchPath),\n                        ShareConstants.TYPE_DEX);\n                }\n                break;\n            case ShareConstants.ERROR_LOAD_PATCH_REWRITE_PATCH_INFO_FAIL:\n                ShareTinkerLog.i(TAG, \"rewrite patch info file corrupted\");\n                tinker.getLoadReporter().onLoadPatchInfoCorrupted(oldVersion, newVersion, patchInfoFile);\n                break;\n            case ShareConstants.ERROR_LOAD_PATCH_VERSION_RESOURCE_DIRECTORY_NOT_EXIST:\n                if (patchVersionDirectory != null) {\n                    ShareTinkerLog.e(TAG, \"patch resource file directory not found:%s\", resourceDirectory.getAbsolutePath());\n                    tinker.getLoadReporter().onLoadFileNotFound(resourceDirectory,\n                        ShareConstants.TYPE_RESOURCE, true);\n                } else {\n                    //should be not here\n                    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                }","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java#L275-L311","documentation":"Defensive throw in the ERROR_LOAD_PATCH_VERSION_RESOURCE_DIRECTORY_NOT_EXIST branch: the loader reports the patch resource directory missing, but patchVersionDirectory is null, so Tinker cannot build the onLoadFileNotFound(resourceDirectory, TYPE_RESOURCE, true) callback and instead crashes with TinkerRuntimeException. Source comment marks it 'should be not here' — an invariant break between load result and local state.","triggerScenarios":"Result code ERROR_LOAD_PATCH_VERSION_RESOURCE_DIRECTORY_NOT_EXIST while patchVersionDirectory is null — the version directory could not be derived from patch info even though a load was attempted.","commonSituations":"Corrupt patch info file; tinker directory manipulated externally; resource patch applied by a plugin version writing a different layout than the loader expects.","solutions":["cleanPatch() and re-apply.","Ensure resource patches are enabled (tinkerEnableResourcePatch / SUPPORT resources flag) consistently between build and runtime.","Keep tinker directory untouched by external tools.","Match gradle plugin and runtime library versions."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (tinker.isTinkerEnabled() && tinker.getTinkerLoadResultIfPresent().patchVersionDirectory == null\n        && tinker.isTinkerLoaded()) {\n    tinker.cleanPatch();\n}","typeGuard":null,"tryCatchPattern":"catch (TinkerRuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"resource file directory not found\")) {\n        Tinker.with(app).cleanPatch();\n    } else throw e;\n}","preventionTips":["Enable resource patching consistently in build config and runtime flags","Keep the tinker directory away from external modification"],"tags":["tinker","hotpatch","android","resource","corrupted-state"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}