HMCL-dev/HMCL · error · ArtifactMalformedException
Invalid forge installation configuration
Error message
Invalid forge installation configuration
What it means
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.
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.
Example fix
// Not caller-fixable; typical recovery: // delete <cache>/neoforge/<installer>.jar, update HMCL, retry installation
Defensive patterns
Strategy: try-catch
Validate before calling
// Before install, ensure all variables referenced by data literals exist
for (String lit : dataMap.values()) for (String var : extractVars(lit)) if (!vars.containsKey(var)) throw new IllegalStateException("Missing var: " + var); Type guard
if (key == null || value == null) { markInstallerCorrupt(); } Try / catch
try { oldInstallTask.run(); } catch (ArtifactMalformedException e) {
LOG.warning("Forge installer config invalid: " + e.getMessage(), e);
Files.deleteIfExists(installerJar); // redownload and retry
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
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
- ForgeNewInstallProfile is malformed
- Invalid neoforge version.
- Account private data is not an object
- authlib-injectors.json -> urls cannot be null.
- Game directory ID cannot be null
AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10).
Data as JSON: /api/errors/71e60313b4c51d67.
Report an issue: GitHub.
Appendix: source
Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeOldInstallTask.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)