HMCL-dev/HMCL · error · JsonParseException

missing Modrinth.dependencies.minecraft

Error message

missing Modrinth.dependencies.minecraft

What it means

Validation of a parsed ModrinthManifest fails because the dependencies object is missing or lacks the required 'minecraft' key. HMCL requires the target Minecraft version to construct the game instance and cannot proceed without it.

Solutions

  1. Add "minecraft": "<version>" to the dependencies object in modrinth.index.json and repackage the .mrpack
  2. Re-download the modpack archive in case of corruption
  3. Use a valid export from the Modrinth App or HMCL exporter that always includes the minecraft dependency

Example fix

// before
"dependencies": { "fabric-loader": "0.15.0" }
// after
"dependencies": { "minecraft": "1.20.1", "fabric-loader": "0.15.0" }
Defensive patterns

Strategy: validation

Validate before calling

if (manifest.getDependencies() == null || manifest.getDependencies().get("minecraft") == null) throw new JsonParseException("missing Modrinth.dependencies.minecraft");

Try / catch

try { ModrinthManifest m = parse(...); m.validate(); } catch (JsonParseException e) { /* reject the pack with a clear message */ }

Prevention

When it happens

Trigger: Loading a modrinth.index.json whose dependencies object is absent, empty, or missing the minecraft entry (JsonUtils.parseModpackManifest / manifest.validate()).

Common situations: Hand-crafted or corrupted .mrpack files; manifests generated by tools that omit the minecraft dependency; truncated downloads.

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

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/modrinth/ModrinthManifest.java:91

    }

    public Map<String, String> getDependencies() {
        return dependencies;
    }

    public String getGameVersion() {
        return dependencies.get("minecraft");
    }

    @Override
    public ModpackProvider getProvider() {
        return ModrinthModpackProvider.INSTANCE;
    }

    @Override
    public void validate() throws JsonParseException, TolerableValidationException {
        if (dependencies == null || dependencies.get("minecraft") == null) {
            throw new JsonParseException("missing Modrinth.dependencies.minecraft");
        }
    }

    public static class File {
        private final String path;
        private final Map<String, String> hashes;
        @Nullable
        private final Map<String, String> env;
        private final List<String> downloads;
        private final int fileSize;

        public File(String path, Map<String, String> hashes, @Nullable Map<String, String> env, List<String> downloads, int fileSize) {
            this.path = path;
            this.hashes = hashes;
            this.env = env;
            this.downloads = downloads;
            this.fileSize = fileSize;
        }

View on GitHub (pinned to 24702dc5a0)