{"record":{"id":"b5e89ee660687a3a","repo":"HMCL-dev/HMCL","slug":"malformed-neoforge-installer-file","errorCode":null,"errorMessage":"Malformed neoforge installer file","messagePattern":"Malformed neoforge installer file","errorType":"exception","errorClass":"ArtifactMalformedException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeOldInstallTask.java","lineNumber":406,"sourceCode":"        FileUtils.copyFile(minecraftJar, isolatedMinecraftJar);\n\n        Map<String, String> vars = new HashMap<>();\n\n        try (FileSystem fs = CompressingUtils.createReadOnlyZipFileSystem(installer)) {\n            for (Map.Entry<String, String> entry : profile.getData().entrySet()) {\n                String key = entry.getKey();\n                String value = entry.getValue();\n\n                vars.put(key, parseLiteral(value,\n                        Collections.emptyMap(),\n                        str -> {\n                            Path dest = Files.createTempFile(tempDir, null, null);\n                            FileUtils.copyFile(fs.getPath(str), dest);\n                            return dest.toString();\n                        }));\n            }\n        } catch (ZipException ex) {\n            throw new ArtifactMalformedException(\"Malformed neoforge installer file\", ex);\n        }\n\n        vars.put(\"SIDE\", \"client\");\n        vars.put(\"MINECRAFT_JAR\", FileUtils.getAbsolutePath(isolatedMinecraftJar));\n        vars.put(\"MINECRAFT_VERSION\", profile.getMinecraft());\n        vars.put(\"ROOT\", FileUtils.getAbsolutePath(gameRepository.getBaseDirectory()));\n        vars.put(\"INSTALLER\", installer.toAbsolutePath().toString());\n        vars.put(\"LIBRARY_DIR\", FileUtils.getAbsolutePath(gameRepository.getLayout().getLibrariesDirectory()));\n\n        updateProgress(0, processors.size());\n\n        Task<?> processorsTask = Task.runSequentially(\n                processors.stream()\n                        .map(processor -> createProcessorTask(processor, vars))\n                        .toArray(Task<?>[]::new));\n\n        dependencies.add(\n                processorsTask.thenComposeAsync(","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeOldInstallTask.java#L388-L424","documentation":"Thrown when extracting files from the NeoForge installer zip during execute(): a ZipException means the installer is not a valid or complete ZIP archive. The file was fetched (or is local) but cannot be opened reliably for processor inputs.","triggerScenarios":"Opening the installer with a zip filesystem and copying entries fails with ZipException — corrupted/partial download, an HTML error page stored as installer.jar, or a truncated local file the user pointed at.","commonSituations":"Interrupted downloads, unstable mirrors, wrong file selected manually in a 'import local installer' flow, antivirus quarantining part of the file.","solutions":["Re-download the NeoForge installer from an official source and retry.","Verify the installer opens as a zip (e.g. CompressingUtils.readZipFully / opening in an archive tool).","Free disk space and disable interfering proxies/AV, then retry."],"exampleFix":"// before\ncatch (ZipException ex) {\n    throw new ArtifactMalformedException(\"Malformed neoforge installer file\", ex);\n}\n// after\nif (!CompressingUtils.checkZip(installer)) {\n    throw new ArtifactMalformedException(\"Malformed neoforge installer file, please re-download\", null);\n}","handlingStrategy":"validation","validationCode":"if (!CompressingUtils.checkZip(installerPath)) {\n    Files.deleteIfExists(installerPath);\n    throw new IOException(\"NeoForge installer is not a valid zip\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    await(task);\n} catch (ArtifactMalformedException e) {\n    Files.deleteIfExists(installerPath);\n    await(task); // re-download and retry once\n}","preventionTips":["Re-download installers from official sources","Verify zip integrity before opening the installer filesystem","Watch for proxies/AV corrupting jar downloads"],"tags":["zip","corrupt-file","neoforge","installer","download"],"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"}