{"record":{"id":"a514b29233391df3","repo":"Tencent/tinker","slug":"patch-lib-file-directory-not-found-warning-why-th-a514b2","errorCode":null,"errorMessage":"patch lib file directory not found, warning why the path is null!!!!","messagePattern":"patch lib 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":244,"sourceCode":"                    tinker.getLoadReporter().onLoadFileNotFound(new File(dexOptPath),\n                        ShareConstants.TYPE_DEX_OPT, false);\n\n                } else {\n                    ShareTinkerLog.e(TAG, \"patch dex opt file not found, but path is null!!!!\");\n                    throw new TinkerRuntimeException(\"patch dex opt file not found, but path is null!!!!\");\n                    // tinker.getLoadReporter().onLoadFileNotFound(null,\n                    //     ShareConstants.TYPE_DEX, false);\n                }\n                break;\n            case ShareConstants.ERROR_LOAD_PATCH_VERSION_LIB_DIRECTORY_NOT_EXIST:\n                if (patchVersionDirectory != null) {\n                    ShareTinkerLog.e(TAG, \"patch lib file directory not found:%s\", libraryDirectory.getAbsolutePath());\n                    tinker.getLoadReporter().onLoadFileNotFound(libraryDirectory,\n                        ShareConstants.TYPE_LIBRARY, true);\n                } else {\n                    //should be not here\n                    ShareTinkerLog.e(TAG, \"patch lib file directory not found, warning why the path is null!!!!\");\n                    throw new TinkerRuntimeException(\"patch lib file directory not found, warning why the path is null!!!!\");\n\n                    // tinker.getLoadReporter().onLoadFileNotFound(null,\n                    //     ShareConstants.TYPE_LIBRARY, true);\n                }\n\n                break;\n            case ShareConstants.ERROR_LOAD_PATCH_VERSION_LIB_FILE_NOT_EXIST:\n                String libPath = ShareIntentUtil.getStringExtra(intentResult,\n                    ShareIntentUtil.INTENT_PATCH_MISSING_LIB_PATH);\n                if (libPath != null) {\n                    //we only pass one missing file and then we break\n                    ShareTinkerLog.e(TAG, \"patch lib file not found:%s\", libPath);\n                    tinker.getLoadReporter().onLoadFileNotFound(new File(libPath),\n                        ShareConstants.TYPE_LIBRARY, false);\n                } else {\n                    ShareTinkerLog.e(TAG, \"patch lib file not found, but path is null!!!!\");\n                    throw new TinkerRuntimeException(\"patch lib file not found, but path is null!!!!\");\n                    // tinker.getLoadReporter().onLoadFileNotFound(null,","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java#L226-L262","documentation":"Thrown in TinkerLoadResult when ERROR_LOAD_PATCH_VERSION_LIB_DIRECTORY_NOT_EXIST is reported but patchVersionDirectory is null. The intended flow reports the missing native-library directory via onLoadFileNotFound(libraryDirectory, TYPE_LIBRARY, true); the throw is the 'should be not here' fallback proving the reconstructed patch layout does not match what the loader inspected.","triggerScenarios":"Loader returns ERROR_LOAD_PATCH_VERSION_LIB_DIRECTORY_NOT_EXIST while the versioned patch directory File resolves to null — i.e. patch metadata exists but its lib/ subdirectory path cannot even be constructed.","commonSituations":"Patch info file corrupted mid-write (process killed during patch apply); tinker directories partially deleted; patch built with a gradle plugin that emits a different directory layout than the loader expects.","solutions":["cleanPatch() to wipe inconsistent state, then re-apply the patch.","Verify the patch APK was built with the same tinker gradle plugin version as the loader in the base APK.","Guard against partial writes by only applying fully downloaded patch files (tinker's default patch apply already validates md5; do not bypass it).","Inspect /tinker/patch info + version dirs on a reproducible device via run-as or adb backup."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"File versionDir = tinker.getTinkerLoadResultIfPresent() != null\n    ? tinker.getTinkerLoadResultIfPresent().patchVersionDirectory : null;\nif (versionDir != null && !(new File(versionDir, \"lib\")).isDirectory()) {\n    tinker.cleanPatch();\n}","typeGuard":null,"tryCatchPattern":"catch (TinkerRuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"lib file directory not found\")) {\n        Tinker.with(app).cleanPatch();\n    } else throw e;\n}","preventionTips":["Never manually delete files under the tinker patch directory","Apply patches only from fully validated downloads"],"tags":["tinker","hotpatch","android","native-lib","corrupted-state"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}