HMCL-dev/HMCL · error · IllegalArgumentException
The author name cannot be empty
Error message
The author name cannot be empty
What it means
Thrown by the ThemePackAuthor compact constructor when the supplied LocalizedText name is empty (mayBeEmpty() is true). An author record with an empty display name is considered meaningless, so the constructor enforces non-emptiness as an invariant.
Solutions
- Provide a non-empty author name in the manifest: {"author": {"name": "Alice"}}.
- In code, ensure the LocalizedText passed to the constructor has at least one non-empty value.
- Fall back to a placeholder name (e.g. "Unknown") if the source metadata is empty.
Example fix
// before
new ThemePackAuthor(LocalizedText.of(""))
// after
new ThemePackAuthor(LocalizedText.of("Alice")) Defensive patterns
Strategy: validation
Validate before calling
boolean nonEmptyName(LocalizedText name) {
return name != null && !name.mayBeEmpty();
} Try / catch
try { new ThemePackAuthor(name); } catch (IllegalArgumentException e) { if (e.getMessage().contains("cannot be empty")) name = LocalizedText.of("Unknown"); else throw e; } Prevention
- Default empty author names to a placeholder before constructing
- Validate UI input so blank names cannot be saved into manifests
- Trim names and reject blank strings early in your pipeline
When it happens
Trigger: Calling new ThemePackAuthor(LocalizedText.of("")) or constructing via fromJson where the name decodes to an empty string, e.g. {"author": {"name": ""}}.
Common situations: Manifest editors that clear the name field but keep the key, scripts that default missing values to empty strings, or users who blanked the author name in a pack-creation UI.
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
- Resolved background built-in wallpaper ID is blank
- Cannot export a background directory as a theme-pack asset
- Empty theme condition context value
- Localized text cannot be empty object
- ${messagePrefix}${value}
AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10).
Data as JSON: /api/errors/6daeec3a4865aa70.
Report an issue: GitHub.
Appendix: source
Thrown at HMCL/src/main/java/org/jackhuang/hmcl/theme/ThemePackAuthor.java:122
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");
}
}
/// Returns the author display name in the current locale.
///
/// @return the localized author display name
public String displayName() {
return name.getText(I18n.getLocale().getCandidateLocales());
}
/// Converts this author to its JSON representation.
///
/// @return the JSON object representing this author
public JsonObject toJsonObject() {
JsonObject object = new JsonObject();
object.add("name", name.toJsonElement());
return object;
}View on GitHub (pinned to 24702dc5a0)