{"record":{"id":"71e60313b4c51d67","repo":"HMCL-dev/HMCL","slug":"invalid-forge-installation-configuration-71e603","errorCode":null,"errorMessage":"Invalid forge installation configuration","messagePattern":"Invalid forge installation configuration","errorType":"exception","errorClass":"ArtifactMalformedException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeOldInstallTask.java","lineNumber":85,"sourceCode":"            this.processor = processor;\n            this.vars = vars;\n            setSignificance(TaskSignificance.MODERATE);\n        }\n\n        @Override\n        public void execute() throws Exception {\n            Map<String, String> outputs = new HashMap<>();\n            boolean miss = false;\n\n            for (Map.Entry<String, String> entry : processor.getOutputs().entrySet()) {\n                String key = entry.getKey();\n                String value = entry.getValue();\n\n                key = parseLiteral(key, vars);\n                value = parseLiteral(value, vars);\n\n                if (key == null || value == null) {\n                    throw new ArtifactMalformedException(\"Invalid forge installation configuration\");\n                }\n\n                outputs.put(key, value);\n\n                Path artifact = Paths.get(key);\n                if (Files.exists(artifact)) {\n                    String code;\n                    try (InputStream stream = Files.newInputStream(artifact)) {\n                        code = (DigestUtils.digestToString(\"SHA-1\", stream));\n                    }\n\n                    if (!Objects.equals(code, value)) {\n                        Files.delete(artifact);\n                        LOG.info(\"Found existing file is not valid: \" + artifact);\n\n                        miss = true;\n                    }\n                } else {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeOldInstallTask.java#L67-L103","documentation":"NeoForgeOldInstallTask.execute() parses the old-style Forge installer's configuration (the processed `data` map of install_profile), substituting variables in each key/value. If substitution leaves either key or value null, the configuration cannot describe a valid artifact mapping, and ArtifactMalformedException is thrown — the installer profile is unusable.","triggerScenarios":"Parsing a legacy Forge/NeoForge installer's data map where parseLiteral(key, vars) or parseLiteral(value, vars) returns null — e.g. a variable referenced in the literal is missing from `vars`, or the literal format is unrecognized.","commonSituations":"A corrupted or tampered old Forge installer jar; an installer version whose install_profile data entries reference variables HMCL doesn't provide; mixing up installer versions with game versions (old installer fed to the modern task or vice versa).","solutions":["Re-download the installer (clear cache) to rule out a corrupt jar.","Update HMCL so all expected profile variables are supported for this installer version.","Make sure the correct task/installer pathway is used for legacy vs modern Forge versions.","Verify the installer's install_profile.json manually to spot unsupported variables."],"exampleFix":"// Not caller-fixable; typical recovery:\n// delete <cache>/neoforge/<installer>.jar, update HMCL, retry installation","handlingStrategy":"try-catch","validationCode":"// Before install, ensure all variables referenced by data literals exist\nfor (String lit : dataMap.values()) for (String var : extractVars(lit)) if (!vars.containsKey(var)) throw new IllegalStateException(\"Missing var: \" + var);","typeGuard":"if (key == null || value == null) { markInstallerCorrupt(); }","tryCatchPattern":"try { oldInstallTask.run(); } catch (ArtifactMalformedException e) {\n    LOG.warning(\"Forge installer config invalid: \" + e.getMessage(), e);\n    Files.deleteIfExists(installerJar); // redownload and retry\n}","preventionTips":["Use intact, freshly downloaded installer jars.","Route legacy vs modern Forge versions through the matching install task.","Keep HMCL updated so installer profile variables are fully supported.","Inspect install_profile.json's data section when substitutions fail."],"tags":["forge","installer","config","parsing"],"backgroundTag":"invalid-config-value","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"}