HMCL-dev/HMCL · error · IOException

mmc-pack.json malformed.

Error message

mmc-pack.json malformed.

What it means

readMultiMCModpackManifest successfully parses mmc-pack.json but the resulting manifest has no components array, so the archive is not a usable MultiMC modpack. HMCL treats this as an IO failure describing malformed launcher metadata.

Solutions

  1. Re-download/re-export the MultiMC instance so mmc-pack.json contains a components array
  2. Add the required components (net.minecraft etc.) to mmc-pack.json
  3. Verify the zip entry mmc-pack.json at the expected root path is the correct file

Example fix

// before
{ "formatVersion": 1 } // no components
// after
{ "formatVersion": 1, "components": [ { "uid": "net.minecraft", "version": "1.20.1" } ] }
Defensive patterns

Strategy: validation

Validate before calling

MultiMCManifest m = JsonUtils.fromNonNullJsonFully(in, MultiMCManifest.class);
if (m.getComponents() == null) throw new IOException("mmc-pack.json malformed.");

Try / catch

try { manifest = MultiMCManifest.readMultiMCModpackManifest(zip, root); } catch (IOException e) { /* treat as invalid modpack archive */ }

Prevention

When it happens

Trigger: Importing a .zip whose mmc-pack.json parses but lacks the components field, or where components is JSON null.

Common situations: Truncated or partially written mmc-pack.json; instances missing component definitions because files were pruned; invalid zips produced by other tools.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCManifest.java:64

    public List<MultiMCManifestComponent> getComponents() {
        return components;
    }

    /**
     * Read MultiMC modpack manifest from zip file
     * @param zipFile the zip file
     * @return the MultiMC modpack manifest.
     * @throws IOException if zip file is malformed
     * @throws com.google.gson.JsonParseException if manifest is malformed.
     */
    public static MultiMCManifest readMultiMCModpackManifest(ZipArchiveReader zipFile, String rootEntryName) throws IOException {
        ZipArchiveEntry mmcPack = zipFile.getEntry(rootEntryName + "mmc-pack.json");
        if (mmcPack == null)
            return null;
        MultiMCManifest manifest = JsonUtils.fromNonNullJsonFully(zipFile.getInputStream(mmcPack), MultiMCManifest.class);
        if (manifest.getComponents() == null)
            throw new IOException("mmc-pack.json malformed.");

        return manifest;
    }

    public static final class MultiMCManifestCachedRequires {
        @SerializedName("equals")
        private final String equalsVersion;

        @SerializedName("uid")
        private final String uid;

        @SerializedName("suggests")
        private final String suggests;

        public MultiMCManifestCachedRequires(String equalsVersion, String uid, String suggests) {
            this.equalsVersion = equalsVersion;
            this.uid = uid;
            this.suggests = suggests;

View on GitHub (pinned to 24702dc5a0)