HMCL-dev/HMCL · error · JsonParseException

Cannot recognize the game version of modpack

Error message

Cannot recognize the game version of modpack 

What it means

Thrown from McbbsModpackProvider.readManifest when the opened modpack ZIP contains neither mcbbs.packmeta nor manifest.json at its root. An Mcbbs modpack is identified by one of these entries, so their absence means the archive is not a recognizable Mcbbs pack.

Solutions

  1. Verify the archive contains mcbbs.packmeta or manifest.json at its ROOT (entries must not be nested under a folder)
  2. Use the correct importer for the format (CurseForge/Modrinth providers for those packs)
  3. Re-zip so manifest files sit at the archive root (cd into the pack folder before zipping)
  4. Re-download the modpack from its original source

Example fix

// before: zip layout
my-pack/manifest.json
// after: zip layout (root)
manifest.json
Defensive patterns

Strategy: validation

Validate before calling

try (ZipFile zip = new ZipFile(packFile)) {
    if (zip.getEntry("mcbbs.packmeta") == null && zip.getEntry("manifest.json") == null)
        throw new IllegalArgumentException("Not an Mcbbs modpack zip");
}

Try / catch

try { provider.readManifest(stream, UTF_8); } catch (IOException e) { if (e.getMessage().contains("cannot be found")) { /* tell user to pick a real mcbbs pack */ } else throw e; }

Prevention

When it happens

Trigger: Importing a ZIP that lacks both root entries — e.g. a CurseForge pack (manifest.json inside a different structure or zipped under a folder), a server pack, or a mod ZIP mistaken for a modpack.

Common situations: Users selecting the wrong file (a mod or resource pack instead of a modpack); modpack zipped with an extra top-level directory so entries aren't at root; non-Mcbbs formats (CurseForge/Modrinth) fed to the Mcbbs importer.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackProvider.java:70

        if (!(modpack.getManifest() instanceof HMCLModpackManifest))
            throw new MismatchedModpackTypeException(getName(), modpack.getManifest().getProvider().getName());

        if (!(dependencyManager.getGameRepository() instanceof HMCLGameRepository repository)) {
            throw new IllegalArgumentException("HMCLModpackProvider requires HMCLGameRepository");
        }

        return new ModpackUpdateTask(instance, new HMCLModpackInstallTask(repository, zipFile, modpack, instance));
    }

    @Override
    public Modpack readManifest(ZipArchiveReader file, Path path, Charset encoding) throws IOException, JsonParseException {
        String manifestJson = CompressingUtils.readTextZipEntry(file, "modpack.json");
        Modpack manifest = JsonUtils.fromNonNullJson(manifestJson, HMCLModpack.class).setEncoding(encoding);
        String gameJson = CompressingUtils.readTextZipEntry(file, "minecraft/pack.json");
        GameInstanceManifest game = JsonUtils.fromNonNullJson(gameJson, GameInstanceManifest.class);
        if (game.jar() == null)
            if (StringUtils.isBlank(manifest.getVersion()))
                throw new JsonParseException("Cannot recognize the game version of modpack " + file + ".");
            else
                manifest.setManifest(HMCLModpackManifest.INSTANCE);
        else
            manifest.setManifest(HMCLModpackManifest.INSTANCE).setGameVersion(game.jar().id());
        return manifest;
    }

    private final static class HMCLModpack extends Modpack {
        @Override
        public Task<?> getInstallTask(DefaultDependencyManager dependencyManager, Path zipFile, GameInstanceID instanceId, String iconUrl) {
            return new HMCLModpackInstallTask((HMCLGameRepository) dependencyManager.getGameRepository(), zipFile, this, instanceId);
        }
    }

}

View on GitHub (pinned to 24702dc5a0)