{"record":{"id":"4081c74ad35bbc2b","repo":"Tencent/tinker","slug":"loadreporter-must-not-be-null-4081c7","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/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java","lineNumber":386,"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":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java#L368-L404","documentation":"Builder.loadReport(LoadReporter) rejects a null reporter. The LoadReporter receives load callbacks (success/failure, patch version change), and Tinker's internals invoke it unconditionally after install, so a null value would NPE later in the lifecycle; the builder fails fast instead.","triggerScenarios":"Calling loadReport(null) — typically a reporter field not yet initialized at builder time, or wiring code that passes an optional dependency.","commonSituations":"Custom ApplicationLike where the reporter is constructed after the builder; DI container returning null for an unbound LoadReporter; tests stubbing the reporter as null.","solutions":["Construct your LoadReporter implementation before building Tinker and pass the instance.","If callbacks are unwanted, pass DefaultLoadReporter rather than null.","Initialize DI bindings before tinker setup, or create the reporter inline in the builder chain."],"exampleFix":"// before\nbuilder.loadReport(loadReporter); // loadReporter field still null\n\n// after\nbuilder.loadReport(new DefaultLoadReporter(context));\n// or initialize the field before building","handlingStrategy":"validation","validationCode":"LoadReporter reporter = (loadReporter != null) ? loadReporter : new DefaultLoadReporter(context);\nbuilder.loadReport(reporter);","typeGuard":"public static LoadReporter orDefault(LoadReporter r, Context ctx) {\n    return r != null ? r : new DefaultLoadReporter(ctx);\n}","tryCatchPattern":null,"preventionTips":["Construct reporter instances before the builder chain runs.","Pass DefaultLoadReporter/DefaultPatchReporter instead of null when callbacks are unwanted.","Initialize DI-provided dependencies before tinker setup."],"tags":["tinker","android","builder","null-check","reporter"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}