HMCL-dev/HMCL · error · IllegalArgumentException

Theme name is empty:

Error message

Theme name is empty: 

What it means

Fires when a theme's display name is absent or blank. The name is required for the theme to be selectable and rendered in the theme picker, so a nameless theme entry (beyond the explicit null-name single-theme pack case) is rejected as malformed. The input at fault is a theme JSON object whose 'name' field is empty.

Solutions

  1. Add a non-empty localized 'name' object to the theme's manifest entry.
  2. Remove or fix the malformed theme pack so its themes all declare display names.
  3. If the pack is intended to be a single unnamed theme, omit the id/name fields entirely rather than supplying an empty name.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at HMCL/src/main/java/org/jackhuang/hmcl/theme/Theme.java:73 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HMCL-dev/HMCL@24702dc5a0 (2026-09-10). Data as JSON: /api/errors/31ccd5fad0b78d46. Report an issue: GitHub.

Appendix: source

Thrown at HMCL/src/main/java/org/jackhuang/hmcl/theme/Theme.java:73

        @Nullable String icon,
        ThemeAppearance appearance,
        @Unmodifiable List<ThemeOverride> overrides) {

    /// Creates a theme.
    ///
    /// @param id          the stable theme identifier inside its pack, or `null` for an unnamed single-theme pack
    /// @param name        the localized display name, or `null` for an unnamed single-theme pack
    /// @param authors     authors of this specific theme
    /// @param description the optional localized description
    /// @param icon        the optional theme-pack relative icon path
    /// @param appearance  the default appearance fields
    /// @param overrides   conditional appearance patches applied in declaration order
    public Theme {
        if (id != null) {
            id = ThemePackManifest.requireThemeId(id);
        }
        if (name != null && name.mayBeEmpty()) {
            throw new IllegalArgumentException("Theme name is empty: " + name);
        }
        if (icon != null) {
            icon = ThemePackAsset.normalizeEntryName(icon);
        }
        authors = List.copyOf(authors);
        Objects.requireNonNull(appearance);
        overrides = List.copyOf(overrides);
    }

    /// Parses a theme from JSON.
    ///
    /// @param object          the theme JSON object
    /// @param requireIdentity whether the theme must declare an explicit ID and name
    /// @return the parsed theme
    /// @throws JsonParseException if required identity fields are missing or malformed
    static Theme fromJson(JsonObject object, boolean requireIdentity) throws JsonParseException {
        Objects.requireNonNull(object);

View on GitHub (pinned to 24702dc5a0)