{"record":{"id":"946876f7f5d31dfb","repo":"Tencent/tinker","slug":"tinkerloadverifyflag-must-not-be-null-946876","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/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java","lineNumber":375,"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":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/Tencent/tinker/blob/1b7ea02c239840f563ea64fb5bd286eb98d4011e/tinker-android/tinker-android-lib/src/main/java/com/tencent/tinker/lib/tinker/Tinker.java#L357-L393","documentation":"Builder.tinkerLoadVerifyFlag(Boolean) rejects a null argument. The flag controls whether dex/so MD5s are verified on every load (slower but safer), and the builder stores it as a Boolean tri-state (null = unset); passing null would be indistinguishable from 'not configured', so it fails fast.","triggerScenarios":"Calling tinkerLoadVerifyFlag(null) — usually because a config value was read from a remote-config map or a nullable field that was never defaulted.","commonSituations":"Remote-config-driven init where the key is missing and the map returns null; Kotlin nullable Boolean passed without defaulting; migration from a config schema where the flag was optional.","solutions":["Default the value before calling the builder: loadVerifyFlag = config.getOrFalse('verifyOnLoad').","In Kotlin, use `config.verifyOnLoad ?: false`.","Fail config parsing loudly when a required boolean is missing instead of propagating null."],"exampleFix":"// before\nBoolean v = remoteConfig.getBoolean(\"tinkerLoadVerify\"); // null when absent\nbuilder.tinkerLoadVerifyFlag(v);\n\n// after\nboolean v = Boolean.TRUE.equals(remoteConfig.getBoolean(\"tinkerLoadVerify\"));\nbuilder.tinkerLoadVerifyFlag(v);","handlingStrategy":"validation","validationCode":"Boolean remote = remoteConfig.getBoolean(\"tinkerLoadVerify\");\nbuilder.tinkerLoadVerifyFlag(Boolean.TRUE.equals(remote)); // never null","typeGuard":"public static boolean nonNullFlag(Boolean b) {\n    return b != null && b;\n}","tryCatchPattern":null,"preventionTips":["Default nullable booleans (Kotlin `?: false`, Java Boolean.TRUE.equals) before builder calls.","Validate remote-config schemas so missing required keys fail at fetch time.","Use primitives in your own config model rather than boxed Booleans."],"tags":["tinker","android","builder","null-check","configuration"],"backgroundTag":null,"analyzedSha":"1b7ea02c239840f563ea64fb5bd286eb98d4011e","analyzedAt":"2026-08-14T15:16:52.110Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}