HMCL-dev/HMCL · error · JsonParseException

LoggingInfo.argument is empty.

Error message

LoggingInfo.argument is empty.

What it means

LoggingInfo.validate() rejects a logging configuration whose 'argument' field is blank. The argument string is the pattern passed to the log4j agent on the command line; without it log configuration is unusable.

Solutions

  1. Provide a non-empty argument value in the logging section of the version JSON
  2. Copy the logging block from the official version manifest for that game version
  3. Remove the logging section entirely if the launcher tolerates missing logging info
  4. Re-download the version JSON from Mojang's official endpoint

Example fix

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

Strategy: validation

Validate before calling

if (logging != null && (logging.getArgument() == null || logging.getArgument().isBlank())) {
    // drop or repair the logging block before constructing LoggingInfo
}

Type guard

static boolean hasNonBlank(JsonObject obj, String key) {
    return obj.has(key) && obj.get(key).isJsonPrimitive() && !obj.get(key).getAsString().isBlank();
}

Try / catch

try {
    loggingInfo.validate();
} catch (JsonParseException e) {
    if (e.getMessage().startsWith("LoggingInfo.argument")) {
        loggingInfo = null; // run without logging config
    } else throw e;
}

Prevention

When it happens

Trigger: Parsing a Minecraft version JSON whose logging.client.arguments member is absent, null, or an empty/whitespace string, then invoking validate().

Common situations: Version JSON copied from an older Minecraft version before logging info was introduced, stripped-down custom manifests, tools that remove 'empty' JSON fields.

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

Appendix: source

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

                          @SerializedName("type") String type) implements Validation {

    public LoggingInfo() {
        this(new IdDownloadInfo());
    }

    public LoggingInfo(IdDownloadInfo file) {
        this(file, "");
    }

    public LoggingInfo(IdDownloadInfo file, String argument) {
        this(file, argument, "");
    }

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