{"record":{"id":"49321fa278b19089","repo":"Tencent/tinker","slug":"loadreporter-must-not-be-null","errorCode":null,"errorMessage":"loadReporter must not be null.","messagePattern":"loadReporter must not be null\\.","errorType":"exception","errorClass":"TinkerRuntimeException","httpStatus":null,"severity":"error","filePath":"tinker-android/tinker-android-lib-no-op/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java","lineNumber":335,"sourceCode":"            }\n            this.status = tinkerFlags;\n            return this;\n        }\n\n        public Builder tinkerLoadVerifyFlag(Boolean verifyMd5WhenLoad) {\n            if (verifyMd5WhenLoad == null) {\n                throw new TinkerRuntimeException(\"tinkerLoadVerifyFlag must not be null.\");\n            }\n            if (this.tinkerLoadVerifyFlag != null) {\n                throw new TinkerRuntimeException(\"tinkerLoadVerifyFlag is already set.\");\n            }\n            this.tinkerLoadVerifyFlag = verifyMd5WhenLoad;\n            return this;\n        }\n\n        public Builder loadReport(LoadReporter loadReporter) {\n            if (loadReporter == null) {\n                throw new TinkerRuntimeException(\"loadReporter must not be null.\");\n            }\n            if (this.loadReporter != null) {\n                throw new TinkerRuntimeException(\"loadReporter is already set.\");\n            }\n            this.loadReporter = loadReporter;\n            return this;\n        }\n\n        public Builder patchReporter(PatchReporter patchReporter) {\n            if (patchReporter == null) {\n                throw new TinkerRuntimeException(\"patchReporter must not be null.\");\n            }\n            if (this.patchReporter != null) {\n                throw new TinkerRuntimeException(\"patchReporter is already set.\");\n            }\n            this.patchReporter = patchReporter;\n            return this;\n        }","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib-no-op/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java#L317-L353","documentation":"Tinker.Builder.loadReport(LoadReporter) throws TinkerRuntimeException(\"loadReporter must not be null.\") when passed a null LoadReporter. The load reporter receives patch-load callbacks (load success/failure, patch applied, etc.) and is a required part of a Tinker configuration — the builder rejects null rather than defaulting, because missing load-failure reporting would hide broken patches.","triggerScenarios":"Calling loadReport(null) — commonly a reporter field that failed to initialize, a constructor ordering issue where the reporter is created after the builder chain runs, or a refactor where the argument was dropped.","commonSituations":"Custom Application classes initializing Tinker in attachBaseContext while the DefaultLoadReporter (which needs the application) is constructed from a not-yet-ready field; flavor-specific reporters not created in all variants; test code omitting reporters.","solutions":["Construct the LoadReporter first (e.g. new DefaultLoadReporter(application)) into a local variable and pass it; verify non-null before the chain.","Initialize fields in attachBaseContext before the builder chain, or build the chain inside onCreate where the application is ready.","In tests, provide a no-op LoadReporter subclass instead of null."],"exampleFix":"// before\nbuilder.loadReport(loadReporter); // field still null at this point\n\n// after\nLoadReporter loadReporter = new DefaultLoadReporter(getApplicationContext());\nbuilder.loadReport(loadReporter);","handlingStrategy":"validation","validationCode":"LoadReporter loadReporter = (customReporter != null)\n        ? customReporter\n        : new DefaultLoadReporter(getApplicationContext());\nbuilder.loadReport(loadReporter);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create reporters into local variables and null-check before the chain","Initialize Tinker only after the Application context is available"],"tags":["android","tinker","builder","null-check","reporter"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}