{"record":{"id":"62d13647e2d399b7","repo":"HMCL-dev/HMCL","slug":"invalid-neoforge-version","errorCode":null,"errorMessage":"Invalid neoforge version.","messagePattern":"Invalid neoforge version\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeInstallTask.java","lineNumber":138,"sourceCode":"            String gameVersion,\n            Path installer) throws IOException, VersionMismatchException {\n        try (FileSystem fs = CompressingUtils.createReadOnlyZipFileSystem(installer)) {\n            String installProfileText = Files.readString(fs.getPath(\"install_profile.json\"));\n            Map<?, ?> installProfile = JsonUtils.fromNonNullJson(installProfileText, Map.class);\n            if (GameComponentType.FORGE.getPatchId().equals(installProfile.get(\"profile\")) && (Files.exists(fs.getPath(\"META-INF/NEOFORGE.RSA\")) || installProfileText.contains(\"neoforge\"))) {\n                ForgeNewInstallProfile profile = JsonUtils.fromNonNullJson(installProfileText, ForgeNewInstallProfile.class);\n                if (!gameVersion.equals(profile.getMinecraft()))\n                    throw new VersionMismatchException(profile.getMinecraft(), gameVersion);\n                return new GameDownloadTask(dependencyManager, manifest)\n                        .thenComposeAsync(minecraftJar -> new ForgeNewInstallTask(\n                                dependencyManager,\n                                manifest,\n                                minecraftJar,\n                                modifyNeoForgeOldVersion(gameVersion, profile.getVersion()),\n                                installer))\n                        .thenApplyAsync(neoForgeVersion -> {\n                    if (!neoForgeVersion.id().equals(GameComponentType.FORGE.getPatchId()) || neoForgeVersion.version() == null) {\n                        throw new IOException(\"Invalid neoforge version.\");\n                    }\n                    return neoForgeVersion.withId(GameComponentType.NEO_FORGE.getPatchId())\n                            .withVersion(\n                                    removePrefix(neoForgeVersion.version().replace(GameComponentType.FORGE.getPatchId(), \"\"), \"-\")\n                            );\n                });\n            } else if (GameComponentType.NEO_FORGE.getPatchId().equals(installProfile.get(\"profile\")) || \"NeoForge\".equals(installProfile.get(\"profile\"))) {\n                ForgeNewInstallProfile profile = JsonUtils.fromNonNullJson(installProfileText, ForgeNewInstallProfile.class);\n                if (!gameVersion.equals(profile.getMinecraft()))\n                    throw new VersionMismatchException(profile.getMinecraft(), gameVersion);\n                return new GameDownloadTask(dependencyManager, manifest)\n                        .thenComposeAsync(minecraftJar -> new NeoForgeOldInstallTask(\n                                dependencyManager,\n                                manifest,\n                                minecraftJar,\n                                modifyNeoForgeNewVersion(profile.getVersion()),\n                                installer));\n            } else {","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeInstallTask.java#L120-L156","documentation":"During NeoForgeInstallTask.install(), the processed installer's version manifest entry is checked: its id must be the Forge patch id and its version non-null before HMCL rewrites it into a NeoForge patch. If the installer produced an entry with a different id or a null version, the installer output isn't a recognizable NeoForge profile and an IOException is thrown.","triggerScenarios":"Running the NeoForge installer and inspecting the returned neoForgeVersion in install(): neoForgeVersion.id() != \"forge\" or neoForgeVersion.version() == null, i.e. the installer's install_profile.json didn't yield the expected Forge-versioned profile.","commonSituations":"A corrupted or wrong installer jar (e.g. Forge installer downloaded for a NeoForge install); NeoForge changing its install_profile format in newer releases so parsing yields an unexpected id; installer executed against the wrong Minecraft version jar.","solutions":["Delete the downloaded NeoForge installer and let HMCL re-download it from a trusted mirror.","Update HMCL — new NeoForge installer formats require updated parsing.","Verify the selected NeoForge version matches the selected Minecraft game version.","Check the installer runs manually (java -jar installer.jar) to rule out a corrupt jar."],"exampleFix":"// Recovery steps rather than code change:\n// 1) delete %APPDATA%/.minecraft/versions/<profile>/neoforge installer files\n// 2) update HMCL, 3) re-attempt NeoForge auto-install","handlingStrategy":"try-catch","validationCode":"// After installer run, sanity-check the profile before transform\nif (profile == null || profile.getVersionManifest() == null) throw new IOException(\"Installer produced no version profile\");","typeGuard":"if (neoForgeVersion == null || !\"forge\".equals(neoForgeVersion.id()) || neoForgeVersion.version() == null) { abortInstall(); }","tryCatchPattern":"try { install(); } catch (IOException e) {\n    if (e.getMessage().equals(\"Invalid neoforge version.\")) { redownloadInstaller(); updateHmcl(); }\n}","preventionTips":["Always download the installer through HMCL from a trusted mirror.","Match the NeoForge installer version to the exact Minecraft game version.","Keep HMCL current so new NeoForge install_profile formats are supported.","Validate the installer jar by running it standalone if auto-install keeps failing."],"tags":["neoforge","installer","parsing","minecraft"],"backgroundTag":"unexpected-response-shape","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"}