HMCL-dev/HMCL · error · UnsupportedOperationException

Unsupported JSON-Patch

Error message

Unsupported JSON-Patch[%s] format version: %d

What it means

Each MultiMC JSON-Patch must have formatVersion == 1. resolveArtifact throws UnsupportedOperationException naming the patch UID and its actual format version when a newer/unknown format is encountered.

Solutions

  1. Downgrade or fix the component's formatVersion to 1 in the instance files
  2. Update HMCL, which may support newer format versions
  3. Re-export the instance from a launcher producing formatVersion 1 patches

Example fix

// before
{ "formatVersion": 2, "uid": "net.minecraft", ... }
// after
{ "formatVersion": 1, "uid": "net.minecraft", ... }
Defensive patterns

Strategy: validation

Validate before calling

boolean allV1 = patches.stream().allMatch(p -> p.getFormatVersion() == 1);
if (!allV1) throw new UnsupportedOperationException("Only JSON-Patch formatVersion 1 is supported");

Try / catch

try { resolveArtifact(patches, id); } catch (UnsupportedOperationException e) { /* prompt user to update HMCL */ }

Prevention

When it happens

Trigger: Importing a MultiMC/Prism instance whose component patch declares formatVersion other than 1 in mmc-pack.json or its patches.

Common situations: Instances created by very new launcher versions bumping the format; hand-edited component files with a wrong formatVersion number.

Related errors


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

Appendix: source

Thrown at HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCInstancePatch.java:259

     * <p>Core methods transforming MultiMCModpack to Official Version Scheme.</p>
     *
     * <p>Most of the information can be transformed in a lossless manner, except for some inputs.
     * See to do marks below for more information</p>
     *
     * @param patches   List of all Json-Patch.
     * @param instanceId the version ID. Used when constructing a manifest.
     * @return The resolved instance.
     */
    public static ResolvedInstance resolveArtifact(List<MultiMCInstancePatch> patches, GameInstanceID instanceId) {
        if (patches.isEmpty()) {
            throw new IllegalArgumentException("Empty components.");
        }

        for (MultiMCInstancePatch patch : patches) {
            Objects.requireNonNull(patch, "patch");

            if (patch.getFormatVersion() != 1) {
                throw new UnsupportedOperationException(
                        String.format("Unsupported JSON-Patch[%s] format version: %d", patch.getID(), patch.getFormatVersion())
                );
            }
        }

        StringBuilder message = new StringBuilder();

        List<String> minecraftArguments;
        ArrayList<Argument> jvmArguments = new ArrayList<>(Arguments.DEFAULT_JVM_ARGUMENTS);
        String mainClass;
        AssetIndexInfo assetIndex;
        int[] javaMajors;
        Library mainJar;
        List<String> traits;
        List<String> tweakers;
        /* TODO: MultiMC use a slightly different way to store jars containing jni files.
            Transforming them to Official Scheme might boost compatibility with other launchers. */
        List<Library> libraries;

View on GitHub (pinned to 24702dc5a0)