{"record":{"id":"414db0abe41000b8","repo":"HMCL-dev/HMCL","slug":"cannot-parse-the-version-of-414db0","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/server/ServerModpackExportTask.java","lineNumber":103,"sourceCode":"        try (Zipper zip = new Zipper(modpackFile)) {\n            Path runDirectory = instance.getRunDirectory();\n            List<ModpackConfiguration.FileInformation> files = new ArrayList<>();\n            zip.putDirectory(runDirectory, \"overrides\", path -> {\n                if (Modpack.acceptFile(path, blackList, exportInfo.getWhitelist())) {\n                    Path file = runDirectory.resolve(path);\n                    if (Files.isRegularFile(file)) {\n                        String relativePath = runDirectory.relativize(file).normalize().toString().replace(File.separatorChar, '/');\n                        files.add(new ModpackConfiguration.FileInformation(relativePath, DigestUtils.digestToString(\"SHA-1\", file)));\n                    }\n                    return true;\n                } else {\n                    return false;\n                }\n            });\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            List<ServerModpackManifest.Addon> addons = new ArrayList<>();\n            addons.add(new ServerModpackManifest.Addon(GameComponentType.GAME.getPatchId(), gameVersion));\n\n            for (GameComponentAnalyzer.Mark mark : instance.getAnalyzer()) {\n                if ((mark.componentType().isModLoader() || mark.componentType() == GameComponentType.OPTIFINE)\n                        && mark.version() != null) {\n                    addons.add(new ServerModpackManifest.Addon(mark.componentType().getPatchId(), mark.version()));\n                }\n            }\n\n            ServerModpackManifest manifest = new ServerModpackManifest(exportInfo.getName(), exportInfo.getAuthor(), exportInfo.getVersion(), exportInfo.getDescription(), StringUtils.removeSuffix(exportInfo.getFileApi(), \"/\"), files, addons);\n            zip.putTextFile(JsonUtils.GSON.toJson(manifest), \"server-manifest.json\");\n        }\n    }\n\n    /// Export options supported by the server modpack format.","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/server/ServerModpackExportTask.java#L85-L121","documentation":"Thrown during server modpack export when the game version of the instance being exported cannot be parsed into a GameVersionNumber. HMCL requires a concrete, resolvable Minecraft game version to embed as the 'game' addon in the exported manifest, so an unresolvable/unknown version makes export impossible.","triggerScenarios":"ServerModpackExportTask.execute() calls instance.getVersion(), which returns GameVersionNumber.unknown() because the instance's game version cannot be resolved (e.g. missing or unparseable version in the instance config).","commonSituations":"Exporting a broken or partially installed instance; an instance whose game version was never set; custom instances with manipulated version JSON; snapshots/odd version strings the resolver cannot recognize.","solutions":["Open the instance settings and set/repair a valid Minecraft game version before exporting.","Reinstall or update the game component (game patch) so the version resolves correctly.","Check instance version JSON files under the instance's 'hmclversion.cfg'/version patches for corruption and fix the version id.","Export from a properly launched instance; launch once successfully so the version resolves, then retry export."],"exampleFix":"// before: instance has no resolvable game version\nGameVersionNumber version = instance.getVersion(); // unknown()\n// after: repair version first, e.g. in instance settings set version to 1.20.1, then\nGameVersionNumber version = instance.getVersion(); // 1.20.1","handlingStrategy":"try-catch","validationCode":"GameVersionNumber version = instance.getVersion();\nif (version == null || version == GameVersionNumber.unknown())\n    return; // cannot export: repair instance version first","typeGuard":null,"tryCatchPattern":"try {\n    exportTask.execute();\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Cannot parse the version of \")) {\n        // prompt user to fix the instance's game version\n    }\n}","preventionTips":["Ensure the instance launches successfully before exporting.","Keep the game version patch intact; don't remove version components.","Verify the instance shows a concrete game version in the UI before export."],"tags":["modpack","export","version-parsing","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"24702dc5a0214034f4c27166d5fd30cad08cec19","analyzedAt":"2026-09-10T12:36:46.680Z","contentChangedAt":"2026-09-10T12:36:46.680Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}