{"record":{"id":"f4d7f6844b4115d3","repo":"HMCL-dev/HMCL","slug":"logginginfo-type-is-empty","errorCode":null,"errorMessage":"LoggingInfo.type is empty.","messagePattern":"LoggingInfo\\.type is empty\\.","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/game/LoggingInfo.java","lineNumber":51,"sourceCode":"@Override\npublic void validate() throws JsonParseException, TolerableValidationException {\n    file.validate();\n    if (StringUtils.isBlank(argument))\n        throw new JsonParseException(\"LoggingInfo.argument is empty.\");\n    if (StringUtils.isBlank(type))\n        throw new JsonParseException(\"LoggingInfo.type is empty.\");\n}","sourceCodeStart":33,"sourceCodeEnd":54,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LoggingInfo.java#L33-L54","documentation":"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.","triggerScenarios":"Parsing a version JSON where logging.client.type is missing or empty while logging info is otherwise present, then calling validate().","commonSituations":"Manually constructed version JSONs, partial third-party manifest mirrors, schema drift between old and new launcher formats.","solutions":["Set the type field (e.g. 'log4j2-xml') in the logging client config","Copy a complete logging block from the official Mojang version manifest","Regenerate the version JSON with a current launcher/toolchain","Skip or drop the logging entry if your loader supports versions without logging config"],"exampleFix":"// before\n\"logging\": {\"client\": {\"argument\": \"-Dlog4j.configurationFile=${path}\", \"file\": {...}}}\n// after\n\"logging\": {\"client\": {\"argument\": \"-Dlog4j.configurationFile=${path}\", \"file\": {...}, \"type\": \"log4j2-xml\"}}","handlingStrategy":"validation","validationCode":"if (logging != null && (logging.getType() == null || logging.getType().isBlank())) {\n    logging.setType(\"log4j2-xml\"); // sensible default for modern versions\n}","typeGuard":"static boolean hasType(JsonObject logging) {\n    return logging.has(\"type\") && logging.get(\"type\").isJsonPrimitive() && !logging.get(\"type\").getAsString().isBlank();\n}","tryCatchPattern":"try {\n    loggingInfo.validate();\n} catch (JsonParseException e) {\n    if (e.getMessage().startsWith(\"LoggingInfo.type\")) {\n        // default the type or skip the entry\n    } else throw e;\n}","preventionTips":["Always include type when authoring logging config","Copy logging blocks verbatim from official manifests","Validate JSON schema before deserialization"],"tags":["json","validation","minecraft"],"backgroundTag":"empty-required-field","analyzedSha":"24702dc5a0214034f4c27166d5fd30cad08cec19","analyzedAt":"2026-09-10T12:36:46.680Z","contentChangedAt":"2026-09-10T12:36:46.680Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}