{"record":{"id":"0d2c6e2b809349b9","repo":"Tencent/tinker","slug":"patchreporter-must-not-be-null-0d2c6e","errorCode":null,"errorMessage":"patchReporter must not be null.","messagePattern":"patchReporter 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":397,"sourceCode":"            }\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        }\n\n        public Builder listener(PatchListener listener) {\n            if (listener == null) {\n                throw new TinkerRuntimeException(\"listener must not be null.\");\n            }\n            if (this.listener != null) {\n                throw new TinkerRuntimeException(\"listener is already set.\");\n            }\n            this.listener = listener;\n            return this;\n        }","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java#L379-L415","documentation":"Thrown by Tinker.Builder.patchReporter when the argument is null. The PatchReporter receives all patch-apply (install) callbacks (onPatchResult, onPatchServiceStart, etc.), so a null value would break patch feedback. Tinker fails fast instead of deferring the failure to patch time.","triggerScenarios":"Calling builder.patchReporter(null), usually because a field or constructor parameter intended to hold the PatchReporter was never initialized, or a refactor changed a method signature to return null.","commonSituations":"Boilerplate copied from the Tinker sample where the reporter instantiation line was deleted, Dagger/dependency-injection providing an unbound @Nullable PatchReporter, or passing a reporter that a factory method returns null for in debug builds.","solutions":["Pass a non-null PatchReporter, e.g. new DefaultPatchReporter(context), in builder.patchReporter(...).","If using DI, verify the PatchReporter binding is present and not declared @Nullable.","Add a unit test asserting the builder receives non-null reporters before Tinker.install runs."],"exampleFix":"// before\nbuilder.patchReporter(null);\n\n// after\nbuilder.patchReporter(new DefaultPatchReporter(context));","handlingStrategy":"validation","validationCode":"PatchReporter reporter = createPatchReporter(context); // factory never returns null\nif (reporter == null) { throw new IllegalStateException(\"PatchReporter binding missing\"); }\nbuilder.patchReport(reporter);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Mark builder wiring parameters @NonNull and run nullness checks in CI.","If using DI, make the PatchReporter binding required (not @Nullable) so missing bindings fail at graph construction.","Unit-test the install path with a real DefaultPatchReporter."],"tags":["tinker","android","builder","null-argument","patch-reporter"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}