HMCL-dev/HMCL · error · ArtifactMalformedException

Invalid forge installation configuration

Error message

Invalid forge installation configuration

What it means

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.

Solutions

  1. Update HMCL to the latest version so new Forge installer tokens are supported
  2. Try a different Forge version whose install_profile.json uses tokens this launcher understands
  3. Inspect install_profile.json outputs entries and confirm every {TOKEN} exists in the profile's 'data' map
  4. Check HMCL logs for which literal failed to resolve and report a bug if it is a standard token

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check that profile data map covers tokens used in outputs
JsonObject profile = ...; // parsed install_profile.json
Set<String> tokens = profile.getAsJsonObject("data").keySet();
// each output key/value either quoted, artifact-style, or a known token in tokens

Try / catch

try {
    new ForgeNewInstallTask(dm, manifest, mcJar, version, installer).run();
} catch (ArtifactMalformedException e) {
    LOG.warning("Forge profile token unresolvable: " + e.getMessage());
    // try a different Forge version
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10). Data as JSON: /api/errors/4555f6dd8c41559b. Report an issue: GitHub.

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeNewInstallTask.java:85

            this.processor = processor;
            this.vars = vars;
            setSignificance(TaskSignificance.MODERATE);
        }

        @Override
        public void execute() throws Exception {
            Map<String, String> outputs = new HashMap<>();
            boolean miss = false;

            for (Map.Entry<String, String> entry : processor.getOutputs().entrySet()) {
                String key = entry.getKey();
                String value = entry.getValue();

                key = parseLiteral(key, vars);
                value = parseLiteral(value, vars);

                if (key == null || value == null) {
                    throw new ArtifactMalformedException("Invalid forge installation configuration");
                }

                outputs.put(key, value);

                Path artifact = Paths.get(key);
                if (Files.exists(artifact)) {
                    String code;
                    try (InputStream stream = Files.newInputStream(artifact)) {
                        code = (DigestUtils.digestToString("SHA-1", stream));
                    }

                    if (!Objects.equals(code, value)) {
                        Files.delete(artifact);
                        LOG.info("Found existing file is not valid: " + artifact);

                        miss = true;
                    }
                } else {

View on GitHub (pinned to 24702dc5a0)