{"record":{"id":"0ad2dddcc36b75d8","repo":"HMCL-dev/HMCL","slug":"malformed-forge-installer-file-install-profile-js","errorCode":null,"errorMessage":"Malformed forge installer file, install_profile.json does not exist.","messagePattern":"Malformed forge installer file, install_profile\\.json does not exist\\.","errorType":"validation","errorClass":"ArtifactMalformedException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeOldInstallTask.java","lineNumber":73,"sourceCode":"        setSignificance(TaskSignificance.MAJOR);\n    }\n\n    @Override\n    public List<Task<?>> getDependencies() {\n        return dependencies;\n    }\n\n    @Override\n    public boolean doPreExecute() {\n        return true;\n    }\n\n    @Override\n    public void execute() throws Exception {\n        try (ZipFile zipFile = new ZipFile(installer.toFile())) {\n            InputStream stream = zipFile.getInputStream(zipFile.getEntry(\"install_profile.json\"));\n            if (stream == null)\n                throw new ArtifactMalformedException(\"Malformed forge installer file, install_profile.json does not exist.\");\n            ForgeInstallProfile installProfile = JsonUtils.fromNonNullJsonFully(stream, ForgeInstallProfile.class);\n\n            // unpack the universal jar in the installer file.\n            Library forgeLibrary = new Library(installProfile.install().getPath());\n            GameRepository gameRepository = dependencyManager.getGameRepository();\n            Path forgeFile = gameRepository.getLayout().getLibraryFile(manifest.id(), forgeLibrary);\n            Files.createDirectories(forgeFile.getParent());\n\n            ZipEntry forgeEntry = zipFile.getEntry(installProfile.install().getFilePath());\n            try (InputStream is = zipFile.getInputStream(forgeEntry);\n                 OutputStream os = Files.newOutputStream(forgeFile, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) {\n                is.transferTo(os);\n            }\n\n            setResult(GameInstancePatch.fromManifest(\n                    installProfile.versionInfo(),\n                    GameComponentType.FORGE.getPatchId(),\n                    selfVersion,","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeOldInstallTask.java#L55-L91","documentation":"ForgeOldInstallTask.execute() opens the legacy Forge installer jar as a ZipFile and requires an install_profile.json entry. If getEntry(\"install_profile.json\") returns null (no stream), ArtifactMalformedException(\"Malformed forge installer file, install_profile.json does not exist.\") is thrown — the file is not a legacy Forge universal/installer jar at all.","triggerScenarios":"installer path passed to ForgeOldInstallTask points to a zip/jar lacking install_profile.json — e.g. a Forge universal jar, a 'installer-win' variant with different layout, or a new-format installer handled by the wrong task; also plain corrupt files that still open as zip.","commonSituations":"Downloaded the wrong artifact (universal instead of installer) from the Forge file server; mirror served an error page that happens to be a zip; HMCL routed a new-format installer (install_title metadata) to the old installer path; user manually swapped the cached file.","solutions":["Re-download the correct '-installer.jar' artifact (not the universal jar) from files.minecraftforge.net","Verify install_profile.json exists inside the jar: 'unzip -l forge-installer.jar | grep install_profile'","Update HMCL — newer builds route new-format installers to ForgeNewInstallTask","Clear the download cache so a stale/wrong cached installer is not reused"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// confirm this is a legacy installer containing install_profile.json\ntry (var zip = new java.util.zip.ZipFile(installer.toFile())) {\n    if (zip.getEntry(\"install_profile.json\") == null)\n        throw new IllegalStateException(\"not a legacy forge installer\");\n}","typeGuard":null,"tryCatchPattern":"try { installTask.execute(); } catch (ArtifactMalformedException e) { if (e.getMessage().contains(\"install_profile.json\")) { downloadCorrectInstallerArtifact(); } else throw e; }","preventionTips":["Download the '-installer.jar' artifact, never the '-universal.jar', for legacy Forge","Ensure HMCL routes new-format installers (with install_title.json) to the new task","List zip entries before use when handling forge jars programmatically","Clear stale cached installers"],"tags":["java","zip","forge-installer","missing-entry"],"backgroundTag":"file-not-found","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"}