HMCL-dev/HMCL · error · JsonParseException

NeoForgeVersion version cannot be null.

Error message

NeoForgeVersion version cannot be null.

What it means

Same validate() chain as the rawVersion check: the normalized `version` field of a NeoForgeVersion entry must be non-null. This is the cleaned version string HMCL actually exposes; if absent, the entry is malformed and a JsonParseException is thrown.

Solutions

  1. Clear cache and refresh the NeoForge version list.
  2. Switch metadata mirror or use the official source in download settings.
  3. Retry later if the mirror is populating a new release.
  4. Update HMCL to handle the new metadata schema.

Example fix

// before: trusting list entries blindly
// after:
if (version.getVersion() == null) continue; // skip malformed entries instead of crashing
Defensive patterns

Strategy: try-catch

Validate before calling

for (JsonObject e : entries) if (e.get("version") == null || e.get("version").isJsonNull()) skip();

Type guard

if (version.getVersion() == null) continue;

Try / catch

try { entries.forEach(NeoForgeVersion::validate); }
catch (JsonParseException e) { LOG.warning("Skipping malformed NeoForge entry", e); }

Prevention

When it happens

Trigger: A BMCLAPI NeoForge metadata entry with a rawVersion but no parsed/normalized version field, encountered while validating entries during NeoForge version list load.

Common situations: Mirror metadata with partially filled fields; schema changes in BMCLAPI response format; corrupted/truncated cached version list.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeBMCLVersionList.java:103

        private final String version;

        @SerializedName("mcversion")
        private final String mcVersion;

        public NeoForgeVersion(String rawVersion, String version, String mcVersion) {
            this.rawVersion = rawVersion;
            this.version = version;
            this.mcVersion = mcVersion;
        }

        @Override
        public void validate() throws JsonParseException {
            if (this.rawVersion == null) {
                throw new JsonParseException("NeoForgeVersion rawVersion cannot be null.");
            }
            if (this.version == null) {
                throw new JsonParseException("NeoForgeVersion version cannot be null.");
            }
            if (this.mcVersion == null) {
                throw new JsonParseException("NeoForgeVersion mcversion cannot be null.");
            }
        }
    }
}

View on GitHub (pinned to 24702dc5a0)