{"record":{"id":"775bf713bed65649","repo":"HMCL-dev/HMCL","slug":"cannot-load-modpacks-without-minecraft","errorCode":null,"errorMessage":"Cannot load modpacks without Minecraft.","messagePattern":"Cannot load modpacks without Minecraft\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackInstallTask.java","lineNumber":233,"sourceCode":"        // Stage #1: Load all related Json-Patch from meta maven or local mod pack.\n\n        try (FileSystem fs = openModpack()) {\n            Path root = getRootPath(fs);\n\n            List<MultiMCManifest.MultiMCManifestComponent> components = Objects.requireNonNull(\n                    Objects.requireNonNull(manifest.getMmcPack(), \"mmc-pack.json\").getComponents(), \"components\"\n            );\n            List<Task<MultiMCInstancePatch>> patches = new ArrayList<>();\n\n            String mcVersion = null;\n            for (MultiMCManifest.MultiMCManifestComponent component : components) {\n                if (MultiMCComponents.getComponent(component.getUid()) == GameComponentType.GAME) {\n                    mcVersion = component.getVersion();\n                    break;\n                }\n            }\n            if (mcVersion == null) {\n                throw new IllegalStateException(\"Cannot load modpacks without Minecraft.\");\n            }\n\n            for (MultiMCManifest.MultiMCManifestComponent component : components) {\n                String componentID = Objects.requireNonNull(component.getUid(), \"Component ID\");\n                Path patchPath = root.resolve(String.format(\"patches/%s.json\", componentID));\n\n                if (Files.exists(patchPath)) {\n                    if (!Files.isRegularFile(patchPath)) {\n                        throw new IllegalArgumentException(\"Json-Patch isn't a file: \" + componentID);\n                    }\n\n                    MultiMCInstancePatch patch = MultiMCInstancePatch.read(componentID, Files.readString(patchPath));\n                    patches.add(Task.supplyAsync(() -> patch)); // TODO: Task.completed has unclear compatibility issue.\n                } else {\n                    patches.add(\n                            new GetTask(MultiMCComponents.getMetaURL(componentID, component.getVersion(), mcVersion))\n                                    .thenApplyAsync(s -> MultiMCInstancePatch.read(componentID, s))\n                    );","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackInstallTask.java#L215-L251","documentation":"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.","triggerScenarios":"preExecute scans manifest components for MultiMCComponents.getComponent(uid) == GameComponentType.GAME and finds none, so mcVersion stays null.","commonSituations":"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.","solutions":["Fix mmc-pack.json so it lists the Minecraft component (uid net.minecraft) with a version.","Verify the modpack opens correctly in MultiMC/Prism before importing.","Re-export the modpack from the launcher."],"exampleFix":"// before (mmc-pack.json)\n\"components\": [{\"uid\": \"org.lwjgl3\"}]\n// after\n\"components\": [{\"uid\": \"net.minecraft\", \"version\": \"1.20.1\"}, {\"uid\": \"org.lwjgl3\"}]","handlingStrategy":"validation","validationCode":"MultiMCManifest m = MultiMCManifest.readMultiMCModpackManifest(reader, root);\nboolean hasGame = m.getComponents().stream().anyMatch(c -> MultiMCComponents.getComponent(c.getUid()) == GameComponentType.GAME);","typeGuard":null,"tryCatchPattern":"try { task.run(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"without Minecraft\")) { /* reject pack as malformed */ } }","preventionTips":["Validate mmc-pack.json declares the net.minecraft component before import","Test packs in MultiMC/Prism before distributing","Avoid hand-editing mmc-pack.json"],"tags":["java","modpack","manifest","missing-component"],"backgroundTag":"missing-required-config-field","analyzedSha":"24702dc5a0214034f4c27166d5fd30cad08cec19","analyzedAt":"2026-09-10T12:36:46.680Z","contentChangedAt":"2026-09-10T12:36:46.680Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}