{"record":{"id":"894d33366d6be97a","repo":"Tencent/tinker","slug":"can-t-get-the-right-intent-return-code-894d33","errorCode":null,"errorMessage":"can't get the right intent return code","messagePattern":"can't get the right intent return code","errorType":"exception","errorClass":"TinkerRuntimeException","httpStatus":null,"severity":"critical","filePath":"tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java","lineNumber":150,"sourceCode":"                    errorCode = ShareConstants.ERROR_LOAD_EXCEPTION_DEX;\n                    break;\n                case ShareConstants.ERROR_LOAD_PATCH_VERSION_RESOURCE_LOAD_EXCEPTION:\n                    errorCode = ShareConstants.ERROR_LOAD_EXCEPTION_RESOURCE;\n                    break;\n                case ShareConstants.ERROR_LOAD_PATCH_UNCAUGHT_EXCEPTION:\n                    errorCode = ShareConstants.ERROR_LOAD_EXCEPTION_UNCAUGHT;\n                    break;\n                default:\n                    break;\n            }\n            tinker.getLoadReporter().onLoadException(exception, errorCode);\n            return false;\n        }\n\n        switch (loadCode) {\n            case ShareConstants.ERROR_LOAD_GET_INTENT_FAIL:\n                ShareTinkerLog.e(TAG, \"can't get the right intent return code\");\n                throw new TinkerRuntimeException(\"can't get the right intent return code\");\n            case ShareConstants.ERROR_LOAD_DISABLE:\n                ShareTinkerLog.w(TAG, \"tinker is disable, just return\");\n                break;\n            // case ShareConstants.ERROR_LOAD_PATCH_NOT_SUPPORTED:\n            //     ShareTinkerLog.w(TAG, \"tinker is not supported, just return\");\n            //     break;\n            case ShareConstants.ERROR_LOAD_PATCH_DIRECTORY_NOT_EXIST:\n            case ShareConstants.ERROR_LOAD_PATCH_INFO_NOT_EXIST:\n                ShareTinkerLog.w(TAG, \"can't find patch file, is ok, just return\");\n                break;\n\n            case ShareConstants.ERROR_LOAD_PATCH_INFO_CORRUPTED:\n                ShareTinkerLog.e(TAG, \"path info corrupted\");\n                tinker.getLoadReporter().onLoadPatchInfoCorrupted(oldVersion, newVersion, patchInfoFile);\n                break;\n\n            case ShareConstants.ERROR_LOAD_PATCH_INFO_BLANK:\n                ShareTinkerLog.e(TAG, \"path info blank, wait main process to restart\");","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java#L132-L168","documentation":"Thrown by TinkerLoadResult#load when the patch-load return code stored in the load-result Intent equals ERROR_LOAD_GET_INTENT_FAIL. That code means the loader could not determine a real result code from the load Intent (corrupt/missing extras), which is an internal inconsistency rather than a normal load failure — hence the runtime exception.","triggerScenarios":"Tinker.with(app).loadPatchAndInvoke(...) / normal load path reaching TinkerLoadResult.load with a result Intent whose return-code extra is absent or ERROR_LOAD_GET_INTENT_FAIL — typically after the patch-loading Intent was rewritten, trimmed by the system, or built by mismatched tinker component versions.","commonSituations":"Mixing tinker-android-lib versions between the loader stub and the library, aggressive Intent sanitization in ROMs or hooked processes (Xposed-style tools), or a patch-process crash leaving a malformed result Intent persisted for the next launch.","solutions":["Align tinker versions across all modules (tinker-android-lib, loader stub generated by the gradle plugin).","Clean the patch: Tinker.with(app).cleanPatch() and let the app relaunch, so the bad result Intent is regenerated.","Update to a maintained Tinker fork/release; older builds had Intent-extra loss issues on some Android versions."],"exampleFix":"// recovery in a custom LoadReporter / ApplicationLike\ntry {\n    tinker.loadPatchAndInvoke(this, patchFile, true, LoadReporter.class.getName());\n} catch (TinkerRuntimeException e) {\n    tinker.cleanPatch(); // drop malformed patch state and continue unpatched\n}","handlingStrategy":"fallback","validationCode":"// before triggering a load, sanity-check tinker state\nTinker tinker = Tinker.with(app);\nif (!tinker.isTinkerEnabled() || !tinker.isTinkerLoaded()) {\n    // do not attempt loadAndInvoke; clean inconsistent state first if a patch dir exists\n    File patchDir = tinker.getPatchDirectory();\n    if (patchDir != null && patchDir.exists() && isMalformedState()) {\n        tinker.cleanPatch();\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    tinker.loadPatchAndInvoke(context, patchFile, useVerify, reporterClass);\n} catch (TinkerRuntimeException e) {\n    if (e.getMessage().contains(\"intent return code\")) {\n        Tinker.with(context).cleanPatch(); // drop malformed state, continue unpatched\n        // optionally re-attempt download+apply on next release\n    } else {\n        throw e;\n    }\n}","preventionTips":["Keep tinker-android-lib and the tinker gradle plugin on identical versions in all buildTypes.","Avoid tools/frameworks that rewrite or strip Intent extras in your process.","On any load anomaly, cleanPatch and relaunch rather than persisting bad state."],"tags":["tinker","android","intent","load-result","internal-error"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}