{"record":{"id":"d6ad7549764c54d0","repo":"Tencent/tinker","slug":"not-initialized","errorCode":null,"errorMessage":"Not initialized!!","messagePattern":"Not initialized!!","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/hotplug/IncrementComponentManager.java","lineNumber":563,"sourceCode":"            if (aInfo.metaData == null) {\n                aInfo.metaData = new Bundle(myCl);\n            }\n            aInfo.metaData.putString(name, value);\n        }\n    }\n\n    private static void skipCurrentTag(XmlPullParser parser) throws IOException, XmlPullParserException {\n        int outerDepth = parser.getDepth();\n        int type;\n        while ((type = parser.next()) != XmlPullParser.END_DOCUMENT\n                && (type != XmlPullParser.END_TAG\n                || parser.getDepth() > outerDepth)) {\n        }\n    }\n\n    private static synchronized void ensureInitialized() {\n        if (!sInitialized) {\n            throw new IllegalStateException(\"Not initialized!!\");\n        }\n    }\n\n    public static boolean isIncrementActivity(String className) {\n        ensureInitialized();\n        return className != null && CLASS_NAME_TO_ACTIVITY_INFO_MAP.containsKey(className);\n    }\n\n    public static ActivityInfo queryActivityInfo(String className) {\n        ensureInitialized();\n        return (className != null ? CLASS_NAME_TO_ACTIVITY_INFO_MAP.get(className) : null);\n    }\n\n    // TODO needs to support rest type of components.\n    public static ResolveInfo resolveIntent(Intent intent) {\n        ensureInitialized();\n\n        int maxPriority = -1;","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-loader/src/main/java/com/tencent/tinker/loader/hotplug/IncrementComponentManager.java#L545-L581","documentation":"IncrementComponentManager keeps incremental component metadata in static maps populated only by commitInstalled(). Query APIs (isIncrementActivity, queryActivityInfo, etc.) call ensureInitialized(), which throws IllegalStateException('Not initialized!!') when a query happens before any successful install/commit in this process.","triggerScenarios":"Calling IncrementComponentManager.queryActivityInfo/isIncrementActivity before ComponentHotplug.install(...) + commitInstalled(...) ran — e.g. interception code executing before patch loading finished, or in a process where hotplug install was skipped.","commonSituations":"Racing ActivityThread.mH interception: the hook receives a launch message before the patch metadata is committed; queries from other processes that never ran install.","solutions":["Ensure ComponentHotplug.install(...) and the component metadata commit complete during Application attachBaseContext, before any component can be started.","Guard query call sites with an initialized check (or try-catch) and treat un-initialized as 'not incremental'.","Do not query IncrementComponentManager from processes that don't run the Tinker hotplug install."],"exampleFix":"// before\nActivityInfo ai = IncrementComponentManager.queryActivityInfo(cls);\n\n// after\nif (IncrementComponentManager.isIncrementActivityEnabledCompat()) { /* only after install */ }\nActivityInfo ai = IncrementComponentManager.queryActivityInfo(cls);","handlingStrategy":"validation","validationCode":"// Track initialization yourself before querying\nif (hotplugInstallCompleted) {\n    ActivityInfo ai = IncrementComponentManager.queryActivityInfo(cls);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return IncrementComponentManager.queryActivityInfo(cls);\n} catch (IllegalStateException e) {\n    return null; // not initialized => treat as non-incremental component\n}","preventionTips":["Complete ComponentHotplug.install and commitInstalled during attachBaseContext before any component launch.","Don't call IncrementComponentManager from processes that skip hotplug install.","Treat 'Not initialized!!' as a normal cold-state condition, not a crash."],"tags":["android","initialization","hotplug","state","tinker"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}