{"record":{"id":"4555f6dd8c41559b","repo":"HMCL-dev/HMCL","slug":"invalid-forge-installation-configuration","errorCode":null,"errorMessage":"Invalid forge installation configuration","messagePattern":"Invalid forge installation configuration","errorType":"validation","errorClass":"ArtifactMalformedException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeNewInstallTask.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/forge/ForgeNewInstallTask.java#L67-L103","documentation":"ProcessorTask.execute() throws ArtifactMalformedException with this message when an output key or value from the processor's outputs map fails literal parsing (parseLiteral returns null). This happens when an output path/value is a {PLACEHOLDER} token not present in the resolved vars map, meaning the installer profile references an undefined variable. It indicates the Forge installation configuration itself is unusable.","triggerScenarios":"During ForgeNewInstallTask execution, a processor output entry key/value is a '{TOKEN}' whose name is not in vars (data map + SIDE/MINECRAFT_JAR/MINECRAFT_VERSION/ROOT/INSTALLER/LIBRARY_DIR), e.g. a token the installer data section failed to resolve.","commonSituations":"Installers from Forge versions with new tokens not yet supported by the launcher; modified install_profile.json referencing undefined variables; null values in the data map after deserialization.","solutions":["Update HMCL to the latest version so new Forge installer tokens are supported","Try a different Forge version whose install_profile.json uses tokens this launcher understands","Inspect install_profile.json outputs entries and confirm every {TOKEN} exists in the profile's 'data' map","Check HMCL logs for which literal failed to resolve and report a bug if it is a standard token"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// Pre-check that profile data map covers tokens used in outputs\nJsonObject profile = ...; // parsed install_profile.json\nSet<String> tokens = profile.getAsJsonObject(\"data\").keySet();\n// each output key/value either quoted, artifact-style, or a known token in tokens","typeGuard":null,"tryCatchPattern":"try {\n    new ForgeNewInstallTask(dm, manifest, mcJar, version, installer).run();\n} catch (ArtifactMalformedException e) {\n    LOG.warning(\"Forge profile token unresolvable: \" + e.getMessage());\n    // try a different Forge version\n}","preventionTips":["Keep HMCL current so new Forge tokens are supported","Avoid modified installers with unknown variables","Test installs of new Forge versions on a scratch game directory first"],"tags":["forge","token-resolution","installer-config"],"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"}