{"record":{"id":"a1bfadb054e29488","repo":"HMCL-dev/HMCL","slug":"malformed-modpack-configuration-a1bfad","errorCode":null,"errorMessage":"Malformed modpack configuration","messagePattern":"Malformed modpack configuration","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/mcbbs/McbbsModpackCompletionTask.java","lineNumber":109,"sourceCode":"        dependencyManager.validateGameInstance(instance);\n        this.dependency = dependencyManager;\n        this.instance = instance;\n        this.modManager = instance.getModManager();\n        this.configurationFile = instance.getModpackConfigurationFile();\n        this.configuration = configuration;\n\n        setStage(\"hmcl.modpack.download\");\n    }\n\n    @Override\n    public CompletableFuture<Void> getFuture(TaskCompletableFuture executor) {\n        return breakable(CompletableFuture.runAsync(wrap(() -> {\n            if (configuration == null) {\n                // Load configuration from disk\n                try {\n                    configuration = JsonUtils.fromNonNullJson(Files.readString(configurationFile), ModpackConfiguration.typeOf(McbbsModpackManifest.class));\n                } catch (IOException | JsonParseException e) {\n                    throw new IOException(\"Malformed modpack configuration\");\n                }\n            }\n            manifest = configuration.getManifest();\n            if (manifest == null) throw new CustomException();\n        })).thenComposeAsync(unused -> {\n            // we first download latest manifest\n            return breakable(CompletableFuture.runAsync(wrap(() -> {\n                if (StringUtils.isBlank(manifest.getFileApi())) {\n                    // skip this phase\n                    throw new CustomException();\n                }\n            })).thenComposeAsync(wrap(unused1 -> {\n                return executor.one(new GetTask(manifest.getFileApi() + \"/manifest.json\"));\n            })).thenComposeAsync(wrap(remoteManifestJson -> {\n                McbbsModpackManifest remoteManifest;\n                // We needs to update modpack from online server.\n                try {\n                    remoteManifest = JsonUtils.fromNonNullJson(remoteManifestJson, McbbsModpackManifest.class);","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/mcbbs/McbbsModpackCompletionTask.java#L91-L127","documentation":"McbbsModpackCompletionTask.getFuture() throws IOException(\"Malformed modpack configuration\") when the local modpack configuration file cannot be read or parsed as a ModpackConfiguration<McbbsModpackManifest>. The original cause is swallowed, so the message alone indicates a corrupt/unreadable config.","triggerScenarios":"configuration is null and reading configurationFile throws IOException, or JsonUtils.fromNonNullJson fails with JsonParseException while parsing the stored Mcbbs modpack configuration.","commonSituations":"Modpack update/resume after the config file was truncated, edited, or written by a different HMCL/modpack version; disk read errors; encoding issues.","solutions":["Reinstall the modpack to regenerate a valid configuration file","Inspect the configuration file for corruption/edits and fix or delete it (fresh install will recreate it)","Check disk/permissions so the file can be read"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"try { JsonUtils.fromNonNullJson(Files.readString(configurationFile), ModpackConfiguration.typeOf(McbbsModpackManifest.class)); } catch (Exception e) { /* config corrupt - reinstall */ }","typeGuard":null,"tryCatchPattern":"try { task.getFuture().get(); } catch (ExecutionException e) { if (e.getCause() instanceof IOException && \"Malformed modpack configuration\".equals(e.getCause().getMessage())) { /* prompt reinstall */ } }","preventionTips":["Do not hand-edit modpack configuration files","Shut down the launcher cleanly so configs finish writing","Back up instance configs before HMCL updates"],"tags":["mcbbs","modpack","json"],"backgroundTag":"json-unmarshal-failed","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"}