HMCL-dev/HMCL · error · JsonParseException

LoggingInfo.type is empty.

Error message

LoggingInfo.type is empty.

What it means

Validation fires when the logging-config object in a version JSON has a blank type field. HMCL requires the log argument type to identify how the log4j argument is substituted; without it the version's logging config is unusable and parsing fails.

Solutions

  1. Set the type field (e.g. 'log4j2-xml') in the logging client config
  2. Copy a complete logging block from the official Mojang version manifest
  3. Regenerate the version JSON with a current launcher/toolchain
  4. Skip or drop the logging entry if your loader supports versions without logging config

Example fix

// before
"logging": {"client": {"argument": "-Dlog4j.configurationFile=${path}", "file": {...}}}
// after
"logging": {"client": {"argument": "-Dlog4j.configurationFile=${path}", "file": {...}, "type": "log4j2-xml"}}
Defensive patterns

Strategy: validation

Validate before calling

if (logging != null && (logging.getType() == null || logging.getType().isBlank())) {
    logging.setType("log4j2-xml"); // sensible default for modern versions
}

Type guard

static boolean hasType(JsonObject logging) {
    return logging.has("type") && logging.get("type").isJsonPrimitive() && !logging.get("type").getAsString().isBlank();
}

Try / catch

try {
    loggingInfo.validate();
} catch (JsonParseException e) {
    if (e.getMessage().startsWith("LoggingInfo.type")) {
        // default the type or skip the entry
    } else throw e;
}

Prevention

When it happens

Trigger: Parsing a version JSON where logging.client.type is missing or empty while logging info is otherwise present, then calling validate().

Common situations: Manually constructed version JSONs, partial third-party manifest mirrors, schema drift between old and new launcher formats.

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

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/game/LoggingInfo.java:51

@Override
public void validate() throws JsonParseException, TolerableValidationException {
    file.validate();
    if (StringUtils.isBlank(argument))
        throw new JsonParseException("LoggingInfo.argument is empty.");
    if (StringUtils.isBlank(type))
        throw new JsonParseException("LoggingInfo.type is empty.");
}

View on GitHub (pinned to 24702dc5a0)