{"record":{"id":"77315e20fdd44b50","repo":"HMCL-dev/HMCL","slug":"instance-77315e","errorCode":null,"errorMessage":"Instance ","messagePattern":"Instance ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackInstallTask.java","lineNumber":148,"sourceCode":"            Path zipFile,\n            Modpack modpack,\n            MultiMCInstanceConfiguration manifest,\n            GameInstanceID instanceId,\n            @Nullable DefaultGameInstance updateTarget) {\n        this.zipFile = zipFile;\n        this.modpack = modpack;\n        this.manifest = manifest;\n        this.instanceId = instanceId;\n        this.updateTarget = updateTarget;\n        this.dependencyManager = dependencyManager;\n        this.repository = dependencyManager.getGameRepository();\n        if (this.updateTarget != null) {\n            dependencyManager.validateGameInstance(this.updateTarget);\n        }\n\n        Path json = repository.getLayout().getModpackConfigurationFile(instanceId);\n        if (this.updateTarget != null && Files.notExists(json))\n            throw new IllegalArgumentException(\"Instance \" + instanceId + \" is not a MultiMC modpack. Cannot update this instance.\");\n\n        @Nullable ModpackConfiguration<MultiMCInstanceConfiguration> config = null;\n        try {\n            if (this.updateTarget != null && Files.exists(json)) {\n                config = JsonUtils.fromJsonFile(json, ModpackConfiguration.typeOf(MultiMCInstanceConfiguration.class));\n\n                if (config == null || !MultiMCModpackProvider.INSTANCE.getName().equals(config.getType()))\n                    throw new IllegalArgumentException(\"Instance \" + instanceId + \" is not a MultiMC modpack. Cannot update this instance.\");\n            }\n        } catch (JsonParseException | IOException ignore) {\n        }\n        this.config = config;\n\n        onDone().register(event -> {\n            abortOpenDraft();\n            if (event.isFailed() && newInstallationReserved)\n                repository.removeInstanceFromDisk(instanceId);\n        });","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/multimc/MultiMCModpackInstallTask.java#L130-L166","documentation":"Thrown by the MultiMCModpackInstallTask update-mode constructor when the target instance has no modpack configuration file on disk. HMCL only allows updating instances that were originally installed from a modpack and recorded as such; an instance without modpackConfiguration.json cannot be updated in place.","triggerScenarios":"Constructing MultiMCModpackInstallTask with the 5-argument constructor taking a DefaultGameInstance (update mode) when repository.getLayout().getModpackConfigurationFile(instanceId) does not exist, i.e. the instance was created manually or not via a modpack install.","commonSituations":"User picks 'update modpack' on an instance created from scratch or imported without a modpack configuration; the configuration file was deleted; the instance belongs to a different launcher layout.","solutions":["Install the modpack into a new instance instead of using the update-mode constructor.","Verify the instance has a valid modpack configuration file before constructing the task.","Delete the instance and reinstall the modpack from its archive."],"exampleFix":"// before\ntask = new MultiMCModpackInstallTask(dm, zip, modpack, cfg, existingInstance);\n// after\nif (Files.exists(dm.getGameRepository().getLayout().getModpackConfigurationFile(existingInstance.getId()))) {\n    task = new MultiMCModpackInstallTask(dm, zip, modpack, cfg, existingInstance);\n} else {\n    task = new MultiMCModpackInstallTask(dm, zip, modpack, cfg, new GameInstanceID(\"fresh-instance\"));\n}","handlingStrategy":"validation","validationCode":"Path cfg = dm.getGameRepository().getLayout().getModpackConfigurationFile(instance.getId());\nif (Files.notExists(cfg)) { /* install fresh instead of constructing update task */ }","typeGuard":null,"tryCatchPattern":"try { task = new MultiMCModpackInstallTask(dm, zip, modpack, cfg, instance); } catch (IllegalArgumentException e) { task = new MultiMCModpackInstallTask(dm, zip, modpack, cfg, newId); }","preventionTips":["Only pass update targets that were installed via a modpack task","Check for modpackConfiguration.json before choosing update mode","Never delete modpack configuration files from instances"],"tags":["java","modpack","illegal-argument","instance-state"],"backgroundTag":"invalid-argument-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"}