HMCL-dev/HMCL · error · JsonParseException

GameRemoteVersion url cannot be blank

Error message

GameRemoteVersion url cannot be blank

What it means

GameRemoteVersionInfo.validate() throws this JsonParseException when the 'url' field of a remote version entry is blank. HMCL needs the download URL to fetch that version's JSON; a blank url makes the entry unusable.

Solutions

  1. Switch or refresh the version-list mirror, then re-open the version list.
  2. Retry later if the version was just published (mirror sync lag).
  3. Use the official Mojang meta as download source if the mirror keeps returning blank urls.
  4. Update HMCL to the latest version.

Example fix

// before: failing on one bad entry aborts the whole list
versionList.forEach(Validation::validate);
// after: filter unusable entries first
versionList.stream()
    .filter(v -> StringUtils.isNotBlank(v.getUrl()))
    .forEach(Validation::validate);
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: The remote version-list JSON contains an entry with an empty/whitespace 'url' field and validate() runs on it — typical of a broken or partially updated mirror list.

Common situations: Mirror (e.g. BMCLAPI) lagging behind Mojang and serving placeholder entries, proxy stripping fields, or a newly published version whose metadata has not propagated.

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/3a8909189f7ad4a3. Report an issue: GitHub.

Appendix: source

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

/**
 *
 * @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)