{"record":{"id":"4bc164e7e3e3665a","repo":"HMCL-dev/HMCL","slug":"cannot-parse-the-version-of-4bc164","errorCode":null,"errorMessage":"Cannot parse the version of ","messagePattern":"Cannot parse the version of ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackExportTask.java","lineNumber":93,"sourceCode":"                }\n            }\n        });\n    }\n\n    /// {@inheritDoc}\n    @Override\n    public void execute() throws Exception {\n        var instanceId = instance.getId();\n        ArrayList<String> blackList = new ArrayList<>(ModAdviser.MODPACK_BLACK_LIST);\n        blackList.add(instanceId + \".jar\");\n        blackList.add(instanceId + \".json\");\n        LOG.info(\"Compressing game files without some files in blacklist, including files or directories: usernamecache.json, asm, logs, backups, versions, assets, usercache.json, libraries, crash-reports, launcher_profiles.json, NVIDIA, TCNodeTracker\");\n        try (Zipper zip = new Zipper(output)) {\n            zip.putDirectory(instance.getRunDirectory(), \".minecraft\", path -> Modpack.acceptFile(path, blackList, whitelist));\n\n            GameVersionNumber version = instance.getVersion();\n            if (version == GameVersionNumber.unknown()) {\n                throw new IOException(\"Cannot parse the version of \" + instanceId);\n            }\n            String gameVersion = version.toString();\n            GameComponentAnalyzer analyzer = instance.getAnalyzer();\n            List<MultiMCManifest.MultiMCManifestComponent> components = new ArrayList<>();\n            components.add(new MultiMCManifest.MultiMCManifestComponent(true, false, MultiMCComponents.getComponent(GameComponentType.GAME), gameVersion));\n\n            for (Map.Entry<String, GameComponentType> pair : MultiMCComponents.getPairs()) {\n                if (pair.getValue().isModLoader()) {\n                    String componentVersion = analyzer.getVersion(pair.getValue());\n                    if (componentVersion != null) {\n                        components.add(new MultiMCManifest.MultiMCManifestComponent(false, false, pair.getKey(), componentVersion));\n                    }\n                }\n            }\n\n            MultiMCManifest mmcPack = new MultiMCManifest(1, components);\n            zip.putTextFile(JsonUtils.GSON.toJson(mmcPack), \"mmc-pack.json\");\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackExportTask.java#L75-L111","documentation":"Thrown while exporting a MultiMC modpack when the instance's game version cannot be determined (GameVersionNumber.unknown()). The MultiMC mmc-pack.json must include a net.minecraft component with an explicit version.","triggerScenarios":"Calling MultiMCModpackExportTask.execute() on an instance whose version metadata is missing or unparseable.","commonSituations":"Exporting broken or hand-built instances; instances whose version.json was deleted; instances installed from non-standard sources.","solutions":["Set the correct game version in the HMCL instance settings before exporting","Restore the instance's versions/<version>/version.json metadata","Reinstall the game files for the instance, then retry the export"],"exampleFix":"// before\nGameVersionNumber version = instance.getVersion(); // unknown() -> IOException\n// after\n// configure instance game version (e.g. 1.20.1) in HMCL settings\nGameVersionNumber version = instance.getVersion(); // resolves\nzip.putDirectory(...); // export proceeds","handlingStrategy":"validation","validationCode":"if (instance.getVersion() == GameVersionNumber.unknown()) throw new IOException(\"Cannot parse the version of \" + instanceId);","typeGuard":"boolean exportable(DefaultGameRepository repo, String id) { return repo.getGameVersion(id).isPresent(); }","tryCatchPattern":"try { exportTask.execute(); } catch (IOException e) { /* fix instance version then retry */ }","preventionTips":["Set the game version in instance settings before export","Keep version metadata files intact","Test getVersion() resolves before running export tasks"],"tags":["multimc","export","game-version","io"],"backgroundTag":"missing-required-config-field","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"}