{"record":{"id":"816e415261bda3fc","repo":"HMCL-dev/HMCL","slug":"self-verification-failed-816e41","errorCode":null,"errorMessage":"Self verification failed","messagePattern":"Self verification failed","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java","lineNumber":175,"sourceCode":"                    }\n\n                } else {\n                    Exception e = executor.getException();\n                    LOG.warning(\"Failed to update to \" + version, e);\n                    if (!(e instanceof CancellationException)) {\n                        Platform.runLater(() -> Controllers.dialog(e.toString(), i18n(\"update.failed\"), MessageType.ERROR));\n                    }\n                }\n            });\n        }));\n    }\n\n    private static void applyUpdate(Path target) throws IOException {\n        LOG.info(\"Applying update to \" + target);\n\n        Path self = getCurrentLocation();\n        if (!IntegrityChecker.DISABLE_SELF_INTEGRITY_CHECK && !IntegrityChecker.isSelfVerified()) {\n            throw new IOException(\"Self verification failed\");\n        }\n        ExecutableHeaderHelper.copyWithHeader(self, target);\n\n        Optional<Path> newFilename = tryRename(target, Metadata.VERSION);\n        if (newFilename.isPresent()) {\n            LOG.info(\"Move \" + target + \" to \" + newFilename.get());\n            try {\n                Files.move(target, newFilename.get());\n                target = newFilename.get();\n            } catch (IOException e) {\n                LOG.warning(\"Failed to move target\", e);\n            }\n        }\n\n        startJava(target);\n    }\n\n    private static void requestUpdate(Path updateTo, Path self) throws IOException {","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateHandler.java#L157-L193","documentation":"applyUpdate copies the current running JAR over the update target to finalize the update. Before doing so it requires the running JAR to be self-verified (unless DISABLE_SELF_INTEGRITY_CHECK is set); otherwise it throws this IOException, refusing to propagate a binary that could have been tampered with.","triggerScenarios":"applyUpdate (reached via processArguments) is invoked while IntegrityChecker.isSelfVerified() returns false and DISABLE_SELF_INTEGRITY_CHECK is false.","commonSituations":"Launching HMCL from a self-compiled or modified JAR and then applying a pending update; a corrupted JAR on disk; running unpacked classes instead of the distributed JAR.","solutions":["Run the official, unmodified HMCL JAR when applying updates","Rebuild with the official build pipeline so the JAR passes IntegrityChecker","Check the JAR for accidental modification (e.g. re-zipping breaks the signature) and re-download","As a last resort for dev builds, set the disable-self-integrity-check property at launch"],"exampleFix":"// before\njava -jar my-custom-build.jar (then applying update fails)\n// after\njava -jar HMCL-official.jar\n// or dev build:\njava -Dhmcl.self.integrity.check.disable=true -jar my-custom-build.jar","handlingStrategy":"try-catch","validationCode":"if (!IntegrityChecker.DISABLE_SELF_INTEGRITY_CHECK && !IntegrityChecker.isSelfVerified()) {\n    return; // skip applying update on unverified jar\n}","typeGuard":null,"tryCatchPattern":"try {\n    handler.applyUpdate(target);\n} catch (IOException e) {\n    LOG.severe(\"Update aborted: running jar failed self verification\", e);\n    // fall back to keeping the current version\n}","preventionTips":["Apply updates only when running the official unmodified JAR","Keep DISABLE_SELF_INTEGRITY_CHECK unset in production","Confirm the JAR was not altered (re-signing/re-zipping breaks verification)"],"tags":["integrity","update","security"],"backgroundTag":"checksum-mismatch","analyzedSha":"24702dc5a0214034f4c27166d5fd30cad08cec19","analyzedAt":"2026-09-10T12:36:46.680Z","contentChangedAt":"2026-09-10T12:36:46.680Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}