{"record":{"id":"667293785ea25abb","repo":"HMCL-dev/HMCL","slug":"instance-667293","errorCode":null,"errorMessage":"Instance ","messagePattern":"Instance ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/server/ServerModpackLocalInstallTask.java","lineNumber":120,"sourceCode":"    ///                                  the exact published object, or another draft is open\n    private ServerModpackLocalInstallTask(\n            DefaultDependencyManager dependencyManager,\n            Path zipFile,\n            Modpack modpack,\n            ServerModpackManifest 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.repository = dependencyManager.getGameRepository();\n        Path run = repository.getLayout().getInstanceRoot(instanceId);\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 Server modpack. Cannot update this instance.\");\n\n        @Nullable ModpackConfiguration<ServerModpackManifest> config = null;\n        try {\n            if (this.updateTarget != null && Files.exists(json)) {\n                config = JsonUtils.fromJsonFile(json, ModpackConfiguration.typeOf(ServerModpackManifest.class));\n\n                if (config == null || !ServerModpackProvider.INSTANCE.getName().equals(config.getType()))\n                    throw new IllegalArgumentException(\"Instance \" + instanceId + \" is not a Server modpack. Cannot update this instance.\");\n            }\n        } catch (JsonParseException | IOException ignore) {\n        }\n\n        onDone().register(event -> {\n            if (this.updateTarget == null && event.isFailed())\n                repository.removeInstanceFromDisk(instanceId);\n        });\n\n        dependents.add(new ModpackInstallTask<>(zipFile, run, modpack.getEncoding(), Collections.singletonList(\"/overrides\"), any -> true, config).withStage(\"hmcl.modpack\"));","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/server/ServerModpackLocalInstallTask.java#L102-L138","documentation":"Thrown by the ServerModpackLocalInstallTask constructor when an update was requested (updateTarget != null) but the target instance has no modpack configuration file, meaning it is not a Server modpack instance. HMCL only allows updating instances that were originally installed as server modpacks.","triggerScenarios":"Constructing ServerModpackLocalInstallTask with a non-null updateTarget for an instanceId whose modpackConfiguration.json does not exist under the repository layout.","commonSituations":"Trying to apply a server modpack 'update' onto a vanilla/other-provider instance; picking the wrong instance in the modpack-update dialog; instance config was deleted manually.","solutions":["Install the modpack as a new instance instead of updating (leave updateTarget null).","Choose the correct instance that was originally installed from a Server modpack.","If the modpack configuration file was deleted, reinstall the modpack rather than updating."],"exampleFix":"// before: updating a non-modpack instance\nnew ServerModpackLocalInstallTask(depMgr, existingVanillaInstanceId, zipFile, updateTarget);\n// after: install fresh (no updateTarget)\nnew ServerModpackLocalInstallTask(depMgr, newInstanceId, zipFile, null);","handlingStrategy":"validation","validationCode":"Path json = repository.getLayout().getModpackConfigurationFile(instanceId);\nboolean canUpdate = updateTarget == null || Files.exists(json);","typeGuard":null,"tryCatchPattern":"try {\n    new ServerModpackLocalInstallTask(depMgr, instanceId, file, updateTarget);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Instance \")) {\n        // fall back to fresh install instead of update\n    }\n}","preventionTips":["Only pass a non-null updateTarget for instances previously installed from a Server modpack.","Do not delete the instance's modpack configuration file.","Check the modpack configuration exists before offering 'update' in UI."],"tags":["modpack","install","illegal-argument","state"],"backgroundTag":"invalid-state-transition","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"}