HMCL-dev/HMCL · error · IOException

Invalid library path:

Error message

Invalid library path: 

What it means

Validation failure while parsing an Mcbbs modpack manifest: the manifestType field must equal 'minecraftModpack'. Thrown as JsonParseException during McbbsModpackManifest.validate() after deserializing the pack's manifest JSON.

Solutions

  1. Set "manifestType": "minecraftModpack" in the manifest JSON
  2. Re-download the modpack from its source
  3. Verify you are importing an Mcbbs-format pack, not a CurseForge/Modrinth pack
  4. Validate the JSON is complete and not truncated

Example fix

// before
{"manifestType": "modpack", ...}
// after
{"manifestType": "minecraftModpack", ...}
Defensive patterns

Strategy: validation

Validate before calling

JsonObject manifest = JsonUtils.fromJson(manifestJson, JsonObject.class);
if (!"minecraftModpack".equals(manifest.get("manifestType").getAsString()))
    throw new IllegalArgumentException("Not an Mcbbs manifest");

Try / catch

try { manifest.validate(); } catch (JsonParseException e) { /* reject pack, show user the manifest error */ }

Prevention

When it happens

Trigger: Reading an mcbbs.packmeta / manifest.json whose manifestType field is missing, misspelled, or set to something other than "minecraftModpack".

Common situations: Importing a modpack that only loosely follows the Mcbbs spec; hand-edited manifest files; packs generated by tools writing a different manifestType; truncated JSON.

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

Appendix: source

Thrown at HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameLauncher.java:196

                result.add("-javaagent:" + extractLwjglUnsafeAgent());
            } catch (Exception e) {
                LOG.warning("Failed to extract lwjgl-unsafe-agent", e);
            }
        }
    }

    private Path extractLwjglUnsafeAgent() throws IOException {
        String agentVersion = JarUtils.getAttribute("hmcl.lwjgl-unsafe-agent.version", null);
        if (agentVersion == null) {
            throw new IOException("Missing hmcl.lwjgl-unsafe-agent.version attribute");
        }

        Library library = new Library(new Artifact("org.glavo", "lwjgl-unsafe-agent", agentVersion));
        String fileName = library.artifact().getFileName();

        Path agentPath = instance.getLayout().getLibraryFile(instance.getId(), library).toAbsolutePath().normalize();
        if (agentPath.toString().contains("=")) {
            throw new IOException("Invalid library path: " + agentPath);
        }

        byte[] bytes;
        try (InputStream input = DefaultLauncher.class.getResourceAsStream("/assets/" + fileName)) {
            if (input == null) {
                throw new IOException("/assets/" + fileName + " not found");
            }

            bytes = input.readAllBytes();
        }

        if (Files.isRegularFile(agentPath)) {
            try {
                if (Files.size(agentPath) == bytes.length) {
                    return agentPath;
                }
            } catch (IOException e) {
                LOG.warning("Failed to check size of " + agentPath, e);

View on GitHub (pinned to 24702dc5a0)