{"record":{"id":"050db629f1828a24","repo":"Tencent/tinker","slug":"tinkerloadverifyflag-must-not-be-null","errorCode":null,"errorMessage":"tinkerLoadVerifyFlag must not be null.","messagePattern":"tinkerLoadVerifyFlag 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":324,"sourceCode":"                ShareTinkerLog.e(TAG, \"patchDirectory is null!\");\n                return;\n            }\n            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        }","sourceCodeStart":306,"sourceCodeEnd":342,"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#L306-L342","documentation":"Tinker.Builder.tinkerLoadVerifyFlag(Boolean) throws TinkerRuntimeException(\"tinkerLoadVerifyFlag must not be null.\") when passed a null Boolean. The flag controls whether patch files are md5-verified at load time, so it must be a definite true/false decision; the builder distinguishes 'not yet set' (null field) from 'set' and requires an explicit value, rejecting null arguments including Boolean variables that were never assigned.","triggerScenarios":"Calling tinkerLoadVerifyFlag(null) — typically a Boolean read from a config map, BuildConfig field, or intent extra that is absent in the current build/variant, or a boxed variable defaulted to null.","commonSituations":"Reading the flag from a JSON/config file where the key is missing in some environments; flavor-specific BuildConfig fields not defined in all variants; deserialized preferences returning null after a schema change.","solutions":["Default the value explicitly before the call: Boolean verify = (cfgFlag != null) ? cfgFlag : Boolean.FALSE; then pass it.","If the source is BuildConfig, define the field in every flavor or use a constant.","Log the resolved value during init to catch null sources early in QA builds."],"exampleFix":"// before\nBoolean verify = configMap.get(\"verifyPatchOnLoad\"); // null when key missing\nbuilder.tinkerLoadVerifyFlag(verify); // throws\n\n// after\nBoolean raw = configMap.get(\"verifyPatchOnLoad\");\nbuilder.tinkerLoadVerifyFlag(raw != null ? raw : Boolean.FALSE);","handlingStrategy":"validation","validationCode":"Boolean raw = config.get(\"tinkerLoadVerifyFlag\");\nboolean verify = (raw != null) ? raw : false; // explicit default\nbuilder.tinkerLoadVerifyFlag(verify);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Unbox with a default before passing Boolean config values","Define BuildConfig fields in every flavor"],"tags":["android","tinker","builder","null-check","configuration"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}