HMCL-dev/HMCL · error · IllegalArgumentException

Empty components.

Error message

Empty components.

What it means

resolveArtifact guard: the list of MultiMC component patches is empty, so there is nothing to resolve into an official version scheme and the conversion cannot proceed. Generic validation of the parsed MultiMC instance components.

Solutions

  1. Ensure the instance archive contains mmc-pack.json with at least one component
  2. Add the mandatory net.minecraft (and net.fabricmc etc.) component patches
  3. Re-export the instance from MultiMC/Prism so patches are included

Example fix

// before
resolveArtifact(Collections.emptyList(), instanceId); // throws
// after
List<MultiMCInstancePatch> patches = readPatchesFrom(mmcPack); // non-empty
resolveArtifact(patches, instanceId);
Defensive patterns

Strategy: validation

Validate before calling

if (patches == null || patches.isEmpty()) throw new IllegalArgumentException("Instance has no components; mmc-pack.json is missing or empty");

Try / catch

try { resolveArtifact(patches, id); } catch (IllegalArgumentException e) { /* abort import with user-facing message */ }

Prevention

When it happens

Trigger: Calling MultiMCInstancePatch.resolveArtifact(List.of(), instanceId), or passing a patches list that ended up empty after collecting mmc-pack.json components.

Common situations: Importing a MultiMC instance whose mmc-pack.json has an empty components array (already rejected earlier) or whose patch files failed to load and were filtered out.

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/07249ad4dff8d28c. Report an issue: GitHub.

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCInstancePatch.java:252

public static ResolvedInstance resolveArtifact(List<MultiMCInstancePatch> patches, GameInstanceID instanceId) {
    if (patches.isEmpty()) {
        throw new IllegalArgumentException("Empty components.");
    }

    for (MultiMCInstancePatch patch : patches) {
        Objects.requireNonNull(patch, "patch");

        if (patch.getFormatVersion() != 1) {
            throw new UnsupportedOperationException(
                    String.format("Unsupported JSON-Patch[%s] format version: %d", patch.getID(), patch.getFormatVersion())
            );
        }
    }

View on GitHub (pinned to 24702dc5a0)