{"record":{"id":"f0436f250d0b3eb7","repo":"Tencent/tinker","slug":"tinkerloadverifyflag-is-already-set-f0436f","errorCode":null,"errorMessage":"tinkerLoadVerifyFlag is already set.","messagePattern":"tinkerLoadVerifyFlag 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":378,"sourceCode":"            this.patchInfoFile = SharePatchFileUtil.getPatchInfoFile(patchDirectory.getAbsolutePath());\n            this.patchInfoLockFile = SharePatchFileUtil.getPatchInfoLockFile(patchDirectory.getAbsolutePath());\n            ShareTinkerLog.w(TAG, \"tinker patch directory: %s\", patchDirectory);\n        }\n\n        public Builder tinkerFlags(int tinkerFlags) {\n            if (this.status != -1) {\n                throw new TinkerRuntimeException(\"tinkerFlag is already set.\");\n            }\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) {","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java#L360-L396","documentation":"Builder.tinkerLoadVerifyFlag may only be called once, same policy as the other builder setters: the stored Boolean is used both as the value and as the 'already set' marker, so a second call throws instead of silently overwriting the first configuration.","triggerScenarios":"Calling tinkerLoadVerifyFlag(...) twice on the same Builder — e.g., a shared init helper sets it, then the app's own setup sets it again with a different value.","commonSituations":"Library and app both configuring tinker; copy-pasted config blocks; a builder field reused across multiple init attempts in tests.","solutions":["Set the flag once, at a single configuration site owned by the app module.","If layered configuration is needed, compute the final boolean first and call the setter once.","Instantiate a new Builder for each independent configuration (e.g., per test)."],"exampleFix":"// before\nbuilder.tinkerLoadVerifyFlag(true);   // base init\nbuilder.tinkerLoadVerifyFlag(false);  // app override -> throws\n\n// after\nboolean verify = flavor == Release ? true : false;\nbuilder.tinkerLoadVerifyFlag(verify); // single call","handlingStrategy":"validation","validationCode":"boolean verify = flavor == ReleaseFlavor || serverConfig.forceVerify;\nbuilder.tinkerLoadVerifyFlag(verify); // exactly one call, computed beforehand","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide the load-verify value at a single configuration site before building.","Prevent helper libraries from calling builder setters the app already set.","Reuse of a Builder across multiple builds (e.g., tests) is unsafe; construct a fresh one."],"tags":["tinker","android","builder","configuration","double-init"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}