HMCL-dev/HMCL · error · JsonParseException

RuledArguments instance does not have either value or…

Error message

RuledArguments instance does not have either value or values member.

What it means

Fired in the Gson deserializer for Minecraft's rules-conditional arguments when a JSON object contains neither 'value' nor 'values'. Such an arguments entry cannot be interpreted, so deserialization of the version JSON fails.

Solutions

  1. Add a 'value' or 'values' member to the offending argument object in the version JSON
  2. Obtain an intact version JSON from the official manifest or the mod loader's official repo
  3. Remove the malformed argument object if it is obsolete
  4. Pre-validate the JSON with a schema check that enforces value/values presence

Example fix

// before
{"rules": [{"action": "allow", "os": {"name": "osx"}}]}
// after
{"rules": [{"action": "allow", "os": {"name": "osx"}}], "value": "-XstartOnFirstThread"}
Defensive patterns

Strategy: try-catch

Validate before calling

static boolean hasValueOrValues(JsonObject rule) {
    return rule.has("value") || rule.has("values");
}
// assert every argument object in the version JSON passes before deserialization

Type guard

static boolean isRuledArgumentUsable(JsonElement el) {
    if (!el.isJsonObject()) return false;
    JsonObject o = el.getAsJsonObject();
    return o.has("value") || o.has("values");
}

Try / catch

try {
    JsonParser.parseRuledArgument(obj);
} catch (JsonParseException e) {
    if (e.getMessage().contains("value or values member")) {
        // skip entry or fetch a repaired version JSON
    } else throw e;
}

Prevention

When it happens

Trigger: Deserializing a Minecraft version JSON 'arguments'/'rules' block where an object contains only 'rules' (or other keys) but no value/values key.

Common situations: Hand-modified version JSON, third-party mod-loader manifests with malformed argument rules, schema drift between launcher versions.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/game/RuledArgument.java:92

JsonElement valuesElement;
if (obj.has("values")) {
    valuesElement = obj.get("values");
} else if (obj.has("value")) {
    valuesElement = obj.get("value");
} else {
    throw new JsonParseException("RuledArguments instance does not have either value or values member.");
}

List<String> values;
if (valuesElement.isJsonPrimitive()) {
    values = Collections.singletonList(valuesElement.getAsString());
} else {
    values = context.deserialize(valuesElement, listTypeOf(String.class).getType());
}

return new RuledArgument(rules, values);

View on GitHub (pinned to 24702dc5a0)