Tencent/tinker · critical · TinkerRuntimeException
can't get the right intent return code
Error message
can't get the right intent return code
What it means
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.
Source
Thrown at tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/TinkerLoadResult.java:150
errorCode = ShareConstants.ERROR_LOAD_EXCEPTION_DEX;
break;
case ShareConstants.ERROR_LOAD_PATCH_VERSION_RESOURCE_LOAD_EXCEPTION:
errorCode = ShareConstants.ERROR_LOAD_EXCEPTION_RESOURCE;
break;
case ShareConstants.ERROR_LOAD_PATCH_UNCAUGHT_EXCEPTION:
errorCode = ShareConstants.ERROR_LOAD_EXCEPTION_UNCAUGHT;
break;
default:
break;
}
tinker.getLoadReporter().onLoadException(exception, errorCode);
return false;
}
switch (loadCode) {
case ShareConstants.ERROR_LOAD_GET_INTENT_FAIL:
ShareTinkerLog.e(TAG, "can't get the right intent return code");
throw new TinkerRuntimeException("can't get the right intent return code");
case ShareConstants.ERROR_LOAD_DISABLE:
ShareTinkerLog.w(TAG, "tinker is disable, just return");
break;
// case ShareConstants.ERROR_LOAD_PATCH_NOT_SUPPORTED:
// ShareTinkerLog.w(TAG, "tinker is not supported, just return");
// break;
case ShareConstants.ERROR_LOAD_PATCH_DIRECTORY_NOT_EXIST:
case ShareConstants.ERROR_LOAD_PATCH_INFO_NOT_EXIST:
ShareTinkerLog.w(TAG, "can't find patch file, is ok, just return");
break;
case ShareConstants.ERROR_LOAD_PATCH_INFO_CORRUPTED:
ShareTinkerLog.e(TAG, "path info corrupted");
tinker.getLoadReporter().onLoadPatchInfoCorrupted(oldVersion, newVersion, patchInfoFile);
break;
case ShareConstants.ERROR_LOAD_PATCH_INFO_BLANK:
ShareTinkerLog.e(TAG, "path info blank, wait main process to restart");View on GitHub (pinned to 1b7ea02c23)
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.
Example fix
// recovery in a custom LoadReporter / ApplicationLike
try {
tinker.loadPatchAndInvoke(this, patchFile, true, LoadReporter.class.getName());
} catch (TinkerRuntimeException e) {
tinker.cleanPatch(); // drop malformed patch state and continue unpatched
} Defensive patterns
Strategy: fallback
Validate before calling
// before triggering a load, sanity-check tinker state
Tinker tinker = Tinker.with(app);
if (!tinker.isTinkerEnabled() || !tinker.isTinkerLoaded()) {
// do not attempt loadAndInvoke; clean inconsistent state first if a patch dir exists
File patchDir = tinker.getPatchDirectory();
if (patchDir != null && patchDir.exists() && isMalformedState()) {
tinker.cleanPatch();
}
} Try / catch
try {
tinker.loadPatchAndInvoke(context, patchFile, useVerify, reporterClass);
} catch (TinkerRuntimeException e) {
if (e.getMessage().contains("intent return code")) {
Tinker.with(context).cleanPatch(); // drop malformed state, continue unpatched
// optionally re-attempt download+apply on next release
} else {
throw e;
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- getPatchPathExtra, but intent is null
- getPatchUseEmergencyMode, but intent is null
- getPatchResultExtra, but intent is null
- intentResult must not be null.
- error load patch version file not exist, but file is null
AI-assisted analysis of Tencent/tinker@1b7ea02c23 (2026-08-14).
Data as JSON: /api/errors/894d33366d6be97a.
Report an issue: GitHub.