{"record":{"id":"f17408778d5f3256","repo":"HMCL-dev/HMCL","slug":"not-a-valid-multimc-modpack","errorCode":null,"errorMessage":"Not a valid MultiMC modpack","messagePattern":"Not a valid MultiMC modpack","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackInstallTask.java","lineNumber":491,"sourceCode":"        return Files.exists(root.resolve(\"instance.cfg\"));\n    }\n\n    private static Path getRootPath(FileSystem fs) throws IOException {\n        Path root = fs.getPath(\"/\");\n\n        if (testPath(root)) {\n            return root;\n        }\n\n        try (DirectoryStream<Path> stream = Files.newDirectoryStream(root)) {\n            for (Path candidate : stream) {\n                if (testPath(candidate)) {\n                    return candidate;\n                }\n            }\n        }\n\n        throw new IOException(\"Not a valid MultiMC modpack\");\n    }\n}\n","sourceCodeStart":473,"sourceCodeEnd":494,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackInstallTask.java#L473-L494","documentation":"When extracting the modpack archive, HMCL looks for instance.cfg at the zip root or one directory deep. If no such entry can be found anywhere in those positions, the archive is not recognized as a MultiMC modpack and the task fails.","triggerScenarios":"getRootPath(fs) called from preExecute/root: neither fs root nor any first-level directory contains instance.cfg.","commonSituations":"The zip contains the instance nested more than one level deep (e.g. zip-of-a-folder-containing-folder); the user zipped the wrong directory; the archive is a CurseForge/Modrinth pack mislabeled as MultiMC.","solutions":["Re-zip the modpack so instance.cfg sits at the archive root or exactly one folder deep.","Verify the pack is actually a MultiMC/Prism instance export (contains mmc-pack.json and instance.cfg).","Extract the archive, navigate to the folder that directly contains instance.cfg, and zip that folder's contents."],"exampleFix":"// before (zip layout)\n/MyPack/instances/MyInstance/instance.cfg   -> too deep\n// after\n/MyPack/instance.cfg                        -> one level deep, accepted","handlingStrategy":"validation","validationCode":"try (FileSystem fs = CompressingUtils.readonly(zip).build()) {\n    boolean ok = Files.exists(fs.getPath(\"/instance.cfg\"));\n    // or scan one level of directories for instance.cfg\n}","typeGuard":null,"tryCatchPattern":"try { task.run(); } catch (IOException e) { if (e.getMessage().equals(\"Not a valid MultiMC modpack\")) { /* prompt re-zip / wrong format */ } }","preventionTips":["Zip the folder that directly contains instance.cfg","Keep the instance folder at most one level deep in the archive","Confirm pack format before choosing MultiMC import"],"tags":["java","modpack","zip-layout","validation"],"backgroundTag":"file-not-found","analyzedSha":"24702dc5a0214034f4c27166d5fd30cad08cec19","analyzedAt":"2026-09-10T12:36:46.680Z","contentChangedAt":"2026-09-10T12:36:46.680Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}