{"record":{"id":"da60eaebae06c35e","repo":"HMCL-dev/HMCL","slug":"malformed-modpack-configuration","errorCode":null,"errorMessage":"Malformed modpack configuration: ","messagePattern":"Malformed modpack configuration: ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameInstance.java","lineNumber":156,"sourceCode":"    ///\n    /// @return whether [#getModpackConfigurationFile()] exists\n    public boolean isModpack() {\n        return Files.exists(getModpackConfigurationFile());\n    }\n\n    /// Reads this instance's HMCL modpack configuration.\n    ///\n    /// @return the parsed configuration, or `null` when the file does not exist\n    /// @throws IOException if the configuration cannot be read\n    public @Nullable ModpackConfiguration<?> readModpackConfiguration() throws IOException {\n        Path file = getModpackConfigurationFile();\n        if (Files.notExists(file)) {\n            return null;\n        }\n        try {\n            return JsonUtils.fromJsonFile(file, ModpackConfiguration.class);\n        } catch (JsonParseException e) {\n            throw new IOException(\"Malformed modpack configuration: \" + file, e);\n        }\n    }\n\n    @Override\n    public Path getRunDirectory() {\n        return getRepository().computeRunDirectory(getId(), isModpack(), getSettings());\n    }\n\n    /// Returns the loaded instance-local game settings, loading them while this instance is current.\n    ///\n    /// @return the settings, or `null` when no local settings exist after loading\n    public @Nullable GameSettings.Instance getSettings() {\n        ensureGameSettingsLoaded();\n        return gameSettings;\n    }\n\n    /// Returns the instance-local game settings, creating an empty settings object when absent.\n    ///","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameInstance.java#L138-L174","documentation":"Thrown during Mcbbs modpack export when the instance's Minecraft version cannot be resolved to a valid GameVersionNumber. The exporter must write a valid gameVersion into the mcbbs manifest, so an unparseable/unknown version is a hard stop (IOException). This typically happens when the instance's version JSON is missing, malformed, or inherits from a broken base.","triggerScenarios":"Calling McbbsModpackExportTask.execute() on an instance whose version cannot be parsed by GameVersionNumber — e.g. instance JSON has no/invalid id or inheritsVersion chain is broken, so instance.getVersion() returns GameVersionNumber.unknown().","commonSituations":"Exporting a corrupted or manually edited instance; exporting an instance created from a damaged version JSON; exporting an instance whose inherited parent version was deleted; exporting vanilla/packaged instances with non-standard version ids.","solutions":["Open the instance and verify its game version is set and valid in the instance settings","Check the instance's version JSON (versions/<id>/<id>.json) for a valid id and complete inheritance chain","Re-download or re-create the instance if its version JSON is corrupted","Export a different, healthy instance to confirm the exporter works"],"exampleFix":"// broken instance json (no id / bad version)\n{\"inheritsFrom\": \"1.7.10-missing\"}\n// after: point to an existing installed version\n{\"id\": \"1.7.10\", \"inheritsFrom\": \"1.7.10\"}","handlingStrategy":"validation","validationCode":"GameVersionNumber v = instance.getVersion();\nif (v == GameVersionNumber.unknown())\n    throw new IllegalStateException(\"Fix instance version before exporting: \" + instanceId);","typeGuard":"if (instance.getVersion() != GameVersionNumber.unknown()) { /* safe to export */ }","tryCatchPattern":"try { task.execute(); } catch (IOException e) { if (e.getMessage().startsWith(\"Cannot parse the version\")) { /* prompt user to fix instance version */ } else throw e; }","preventionTips":["Verify the instance launches correctly before exporting","Keep inherited version chains intact (don't delete parent versions)","Validate instance JSON after manual edits"],"tags":["modpack","export","version-parsing"],"backgroundTag":"invalid-argument-format","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"}