HMCL-dev/HMCL · error · JsonParseException
The author name is null
Error message
The author name is null
What it means
Thrown by ThemePackAuthor.fromJson when LocalizedText.fromJson returns null for the "name" element — i.e. the name key exists but its content is empty or not decodable into a LocalizedText. The library treats a null decoded name as invalid rather than creating an author with no display name.
Solutions
- Set a concrete name value: {"author": {"name": "Alice"}}.
- If using the localized form, supply at least one locale entry, e.g. {"name": {"en": "Alice"}}.
- Remove the "name": null placeholder before packaging.
- Check LocalizedText.fromJson's accepted shapes and conform the name element to them.
Example fix
// before
{"author": {"name": null}}
// after
{"author": {"name": "Alice"}} Defensive patterns
Strategy: validation
Validate before calling
boolean decodableName(JsonElement nameJson) {
if (nameJson == null || nameJson.isJsonNull()) return false;
if (nameJson.isJsonPrimitive()) return nameJson.getAsJsonPrimitive().isString() && !nameJson.getAsString().isBlank();
return nameJson.isJsonObject();
} Try / catch
try { ThemePackAuthor a = ThemePackAuthor.fromJson(json); } catch (JsonParseException e) { if ("The author name is null".equals(e.getMessage())) supplyDefaultName(); throw e; } Prevention
- Never leave "name": null placeholders in shipped manifests
- Provide at least one locale entry for localized names
- Round-trip test manifests through the loader before release
When it happens
Trigger: Author object with a null or empty-structure name, e.g. {"author": {"name": null}} or {"author": {"name": {}}}, when ThemePackAuthor.fromJson decodes it.
Common situations: Templates that leave "name": null as a placeholder, programmatic manifest generation that skips filling the localized name, or JSON round-tripping that dropped the name value.
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
- Invalid theme-pack manifest
- Manifest is null
- Missing author name:
- Theme-pack author must be an object or a string
- Theme-pack authors must be an array
AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10).
Data as JSON: /api/errors/89d1e3a39b9662a7.
Report an issue: GitHub.
Appendix: source
Thrown at HMCL/src/main/java/org/jackhuang/hmcl/theme/ThemePackAuthor.java:107
try {
return new ThemePackAuthor(LocalizedText.plain(primitive.getAsString()));
} catch (IllegalArgumentException e) {
throw new JsonParseException(e);
}
}
if (!(json instanceof JsonObject jsonObject)) {
throw new JsonParseException("Theme-pack author must be an object or a string");
}
JsonElement nameJson = jsonObject.get("name");
if (nameJson == null) {
throw new JsonParseException("Missing author name: " + json);
}
LocalizedText name = LocalizedText.fromJson(nameJson);
if (name == null) {
throw new JsonParseException("The author name is null");
}
try {
return new ThemePackAuthor(name);
} catch (IllegalArgumentException e) {
throw new JsonParseException(e);
}
}
/// Creates theme-pack author metadata.
///
/// @param name the localized author display name
public ThemePackAuthor {
if (name.mayBeEmpty()) {
throw new IllegalArgumentException("The author name cannot be empty");
}
}
View on GitHub (pinned to 24702dc5a0)