HMCL-dev/HMCL · error · JsonParseException
IdDownloadInfo id can not be null
Error message
IdDownloadInfo id can not be null
What it means
IdDownloadInfo.validate() rejects a download-info entry whose id field is blank/null when a JSON version manifest is parsed. This library throws it because the id is the key used to build download URLs; without it the artifact cannot be located.
Solutions
- Check the JSON source and fill in the missing id field for the affected entry
- Re-download a pristine version JSON from the official manifest URL instead of a corrupted local copy
- Fix the third-party tool that generated the partial download metadata
- Wrap parsing in error handling and skip/re-fetch the offending entry
Example fix
// before
{"name": "something.jar", "url": "https://..."}
// after
{"id": "something", "name": "something.jar", "url": "https://..."} Defensive patterns
Strategy: validation
Validate before calling
if (downloadInfo == null || downloadInfo.getId() == null || downloadInfo.getId().isBlank()) {
throw new IllegalArgumentException("entry must have a non-blank id before parsing");
} Type guard
static boolean hasId(JsonObject obj) {
return obj.has("id") && obj.get("id").isJsonPrimitive() && !obj.get("id").getAsString().isBlank();
} Try / catch
try {
version.validate();
} catch (JsonParseException e) {
if (e.getMessage().contains("id can not be null")) {
// re-fetch or repair the version JSON
} else throw e;
} Prevention
- Never hand-edit version JSON download entries
- Re-fetch manifests from the official source after corruption
- Schema-validate version JSONs before loading
- Log the offending entry path to locate the bad object quickly
When it happens
Trigger: Deserializing a version/library asset JSON where a download object has no 'id' member or an empty-string id, then calling validate() as part of the version parsing pipeline.
Common situations: Hand-edited or truncated Minecraft version JSON, third-party launcher configs with incomplete library metadata, upstream version manifests changed or pruned.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- accountID is missing
- GameRemoteVersions.versions cannot be null
- LoggingInfo.argument is empty.
- LoggingInfo.type is empty.
- authlib-injectors.json -> urls cannot be null.
AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10).
Data as JSON: /api/errors/88b28638c37492ed.
Report an issue: GitHub.
Appendix: source
Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/game/IdDownloadInfo.java:62
public IdDownloadInfo(String id, String url, String sha1) {
this(id, url, sha1, 0);
}
public IdDownloadInfo(String id, String url, String sha1, int size) {
super(url, sha1, size);
this.id = id;
}
public String getId() {
return id;
}
@Override
public void validate() throws JsonParseException, TolerableValidationException {
super.validate();
if (StringUtils.isBlank(id))
throw new JsonParseException("IdDownloadInfo id can not be null");
}
}
View on GitHub (pinned to 24702dc5a0)