HMCL-dev/HMCL · error · JsonParseException

GameRemoteVersion id cannot be blank

Error message

GameRemoteVersion id cannot be blank

What it means

GameRemoteVersionInfo.validate() throws this JsonParseException when the 'id' field (mapped from gameVersion, message says 'id') is blank in the parsed remote version-list entry. HMCL requires a non-blank identifier to key the version entry; a blank id makes the list entry invalid.

Solutions

  1. Refresh the version list from a different mirror (switch download source in HMCL settings).
  2. Retry after transient mirror issues; official Mojang meta is usually well-formed.
  3. Update HMCL so its parser/expectations match the current remote list format.

Example fix

// before: trusting every list entry
List<GameRemoteVersionInfo> list = JsonUtils.fromJson(json, LIST_TYPE);
list.forEach(Validation::validate);
// after: skip malformed entries
list.stream().filter(v -> StringUtils.isNotBlank(v.getId()))
    .forEach(Validation::validate);
Defensive patterns

Strategy: validation

Validate before calling

if (StringUtils.isBlank(entryJson.optString("id"))) skipEntry(entryJson);

Type guard

boolean hasId(GameRemoteVersionInfo v) { return v != null && StringUtils.isNotBlank(v.getId()); }

Try / catch

try { info.validate(); } catch (JsonParseException e) { refreshVersionListFromMirror(); }

Prevention

When it happens

Trigger: The remote version-list JSON (official Mojang or a mirror like BMCLAPI) contains an entry with an empty or whitespace-only 'id' field, and validate() runs on the deserialized record.

Common situations: Mirror returning degraded/incomplete version lists, upstream adding new entry shapes HMCL does not expect, or a proxy injecting malformed JSON.

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


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

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersionInfo.java:44

import java.time.Instant;

/**
 *
 * @author huangyuhui
 */
@JsonSerializable
public record GameRemoteVersionInfo(
        @SerializedName("id") String gameVersion,
        @SerializedName("time") Instant time,
        @SerializedName("releaseTime") Instant releaseTime,
        @SerializedName("type") ReleaseType type,
        @SerializedName("url") String url) implements Validation {

    @Override
    public void validate() throws JsonParseException {
        if (StringUtils.isBlank(gameVersion))
            throw new JsonParseException("GameRemoteVersion id cannot be blank");
        if (StringUtils.isBlank(url))
            throw new JsonParseException("GameRemoteVersion url cannot be blank");
    }
}

View on GitHub (pinned to 24702dc5a0)