{"record":{"id":"9335bc7e70439ef0","repo":"HMCL-dev/HMCL","slug":"instance-cfg-not-found","errorCode":null,"errorMessage":"`instance.cfg` not found, ","messagePattern":"`instance\\.cfg` not found, ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackProvider.java","lineNumber":86,"sourceCode":"            if (idx >= 0\n                    && entryName.length() == idx + instanceFileName.length() + 1\n                    && entryName.startsWith(instanceFileName, idx + 1))\n                return entryName.substring(0, idx + 1);\n        }\n\n        throw new IOException(\"Not a valid MultiMC modpack\");\n    }\n\n    @Override\n    public Modpack readManifest(ZipArchiveReader modpackFile, Path modpackPath, Charset encoding) throws IOException {\n        String rootEntryName = getRootEntryName(modpackFile);\n        MultiMCManifest manifest = MultiMCManifest.readMultiMCModpackManifest(modpackFile, rootEntryName);\n\n        String name = rootEntryName.isEmpty() ? FileUtils.getNameWithoutExtension(modpackPath) : rootEntryName.substring(0, rootEntryName.length() - 1);\n        ZipArchiveEntry instanceEntry = modpackFile.getEntry(rootEntryName + \"instance.cfg\");\n\n        if (instanceEntry == null)\n            throw new IOException(\"`instance.cfg` not found, \" + modpackFile + \" is not a valid MultiMC modpack.\");\n        try (InputStream instanceStream = modpackFile.getInputStream(instanceEntry)) {\n            MultiMCInstanceConfiguration cfg = new MultiMCInstanceConfiguration(name, instanceStream, manifest);\n            return new Modpack(cfg.getName(), \"\", \"\", cfg.getGameVersion(), cfg.getNotes(), encoding, cfg) {\n                @Override\n                public Task<?> getInstallTask(DefaultDependencyManager dependencyManager, Path zipFile, GameInstanceID instanceId, String iconUrl) {\n                    return new MultiMCModpackInstallTask(dependencyManager, zipFile, this, cfg, instanceId);\n                }\n            };\n        }\n    }\n\n}\n","sourceCodeStart":68,"sourceCodeEnd":99,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackProvider.java#L68-L99","documentation":"After locating the modpack root entry, readManifest requires an instance.cfg entry inside that root; instance.cfg holds the MultiMC instance configuration HMCL needs to build the Modpack metadata. Its absence means the archive looks like a MultiMC pack but is incomplete.","triggerScenarios":"MultiMCModpackProvider.readManifest: rootEntryName was resolved from mmc-pack.json, but modpackFile.getEntry(rootEntryName + \"instance.cfg\") returns null.","commonSituations":"A partially exported or hand-trimmed MultiMC instance where instance.cfg was deleted; a zip that has mmc-pack.json but lost instance.cfg; mixed archives assembled manually.","solutions":["Add a valid instance.cfg to the instance folder inside the zip (copy one from a working MultiMC instance and edit name/version).","Re-export the modpack from MultiMC/Prism Launcher so instance.cfg is included.","Report the pack as broken to its maintainer and use a complete archive."],"exampleFix":"// before (zip)\n/modpack/mmc-pack.json           (instance.cfg missing)\n// after\n/modpack/mmc-pack.json\n/modpack/instance.cfg            (required)","handlingStrategy":"validation","validationCode":"try (ZipArchiveReader r = new ZipArchiveReader(zip)) {\n    boolean ok = r.getEntry(\"instance.cfg\") != null\n        || r.getEntry(rootDir + \"/instance.cfg\") != null;\n}","typeGuard":null,"tryCatchPattern":"try { Modpack m = provider.readManifest(reader, zipPath, encoding); } catch (IOException e) { if (e.getMessage().contains(\"instance.cfg` not found\")) { /* reject/repair the pack */ } }","preventionTips":["Never delete instance.cfg from exported instances","Re-export from MultiMC/Prism after manual edits","Validate archive completeness before distributing"],"tags":["java","modpack","missing-file","manifest"],"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-16T04:17:20.429Z"}