HMCL-dev/HMCL · error · IllegalStateException

Cannot load modpacks without Minecraft.

Error message

Cannot load modpacks without Minecraft.

What it means

The modpack's mmc-pack.json must declare a component whose UID maps to the GAME component type (i.e. Minecraft itself), from which the game version is derived. If no such component exists, HMCL cannot determine which Minecraft version to install and aborts.

Solutions

  1. Fix mmc-pack.json so it lists the Minecraft component (uid net.minecraft) with a version.
  2. Verify the modpack opens correctly in MultiMC/Prism before importing.
  3. Re-export the modpack from the launcher.

Example fix

// before (mmc-pack.json)
"components": [{"uid": "org.lwjgl3"}]
// after
"components": [{"uid": "net.minecraft", "version": "1.20.1"}, {"uid": "org.lwjgl3"}]
Defensive patterns

Strategy: validation

Validate before calling

MultiMCManifest m = MultiMCManifest.readMultiMCModpackManifest(reader, root);
boolean hasGame = m.getComponents().stream().anyMatch(c -> MultiMCComponents.getComponent(c.getUid()) == GameComponentType.GAME);

Try / catch

try { task.run(); } catch (IllegalStateException e) { if (e.getMessage().contains("without Minecraft")) { /* reject pack as malformed */ } }

Prevention

When it happens

Trigger: preExecute scans manifest components for MultiMCComponents.getComponent(uid) == GameComponentType.GAME and finds none, so mcVersion stays null.

Common situations: A hand-crafted or corrupted modpack whose mmc-pack.json omits the 'net.minecraft' component; a modpack exported with components only in patches/ but not listed in mmc-pack.json; unknown/renamed component UIDs.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackInstallTask.java:233

        // Stage #1: Load all related Json-Patch from meta maven or local mod pack.

        try (FileSystem fs = openModpack()) {
            Path root = getRootPath(fs);

            List<MultiMCManifest.MultiMCManifestComponent> components = Objects.requireNonNull(
                    Objects.requireNonNull(manifest.getMmcPack(), "mmc-pack.json").getComponents(), "components"
            );
            List<Task<MultiMCInstancePatch>> patches = new ArrayList<>();

            String mcVersion = null;
            for (MultiMCManifest.MultiMCManifestComponent component : components) {
                if (MultiMCComponents.getComponent(component.getUid()) == GameComponentType.GAME) {
                    mcVersion = component.getVersion();
                    break;
                }
            }
            if (mcVersion == null) {
                throw new IllegalStateException("Cannot load modpacks without Minecraft.");
            }

            for (MultiMCManifest.MultiMCManifestComponent component : components) {
                String componentID = Objects.requireNonNull(component.getUid(), "Component ID");
                Path patchPath = root.resolve(String.format("patches/%s.json", componentID));

                if (Files.exists(patchPath)) {
                    if (!Files.isRegularFile(patchPath)) {
                        throw new IllegalArgumentException("Json-Patch isn't a file: " + componentID);
                    }

                    MultiMCInstancePatch patch = MultiMCInstancePatch.read(componentID, Files.readString(patchPath));
                    patches.add(Task.supplyAsync(() -> patch)); // TODO: Task.completed has unclear compatibility issue.
                } else {
                    patches.add(
                            new GetTask(MultiMCComponents.getMetaURL(componentID, component.getVersion(), mcVersion))
                                    .thenApplyAsync(s -> MultiMCInstancePatch.read(componentID, s))
                    );

View on GitHub (pinned to 24702dc5a0)