{"record":{"id":"437fb69fc89927a6","repo":"Tencent/tinker","slug":"loadreporter-is-already-set-437fb6","errorCode":null,"errorMessage":"loadReporter is already set.","messagePattern":"loadReporter is already set\\.","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":389,"sourceCode":"        }\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        }\n\n        public Builder listener(PatchListener listener) {\n            if (listener == null) {","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java#L371-L407","documentation":"Thrown by Tinker.Builder.loadReport when the LoadReporter has already been assigned. The builder enforces single assignment of each collaborator so Tinker's lifecycle callbacks always go to exactly one reporter. Calling loadReport twice on the same Builder instance violates that contract.","triggerScenarios":"Calling Tinker.with(app).getBuilder()... i.e. invoking builder.loadReport(...) a second time on the same Builder instance — typically in a custom ApplicationLike#onCreate where Tinker is installed in multiple process branches or the builder is stored in a static field and configured again.","commonSituations":"Re-running initialization code after a configuration change, sharing one Builder across helper classes that each try to set a reporter, or copy-pasting the sample DefaultLoadReporter wiring twice. Also occurs when Tinker.install is called from both the Application and a library's init block.","solutions":["Ensure loadReport is called exactly once per Builder instance; move all builder configuration into a single Tinker.install flow.","If multiple components need load feedback, keep one LoadReporter and fan out events from it instead of registering several.","Check that Tinker.isTinkerInstalled() is false before building/installing again to avoid double initialization on process restarts."],"exampleFix":"// before\nbuilder.loadReport(new DefaultLoadReporter(context));\nbuilder.loadReport(new MyLoadReporter(context)); // throws\n\n// after\nbuilder.loadReport(new MyLoadReporter(context)); // single reporter that delegates where needed","handlingStrategy":"validation","validationCode":"// before configuring: ensure not already installed, and configure once\nif (!Tinker.isTinkerInstalled()) {\n    Tinker.install(new Tinker.Builder(app)\n        .loadReport(new DefaultLoadReporter(app))\n        .patchReport(new DefaultPatchReporter(app))\n        .listener(new DefaultPatchListener(app))\n        .build());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize all Tinker builder configuration in one method invoked from ApplicationLike#onCreate.","Never cache the Tinker.Builder in a static field that can be reconfigured later.","Add an isTinkerInstalled() check before building so process re-entry cannot double-configure."],"tags":["tinker","android","builder","double-init","load-reporter"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}