{"record":{"id":"fa042a002484bec9","repo":"HMCL-dev/HMCL","slug":"instance-fa042a","errorCode":null,"errorMessage":"Instance ","messagePattern":"Instance ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/server/ServerModpackRemoteInstallTask.java","lineNumber":102,"sourceCode":"    /// @param instanceId        the target instance id\n    /// @param updateTarget      the existing instance selecting update mode, or `null` for install\n    /// @throws IllegalArgumentException if an update target has no compatible configuration\n    /// @throws IllegalStateException    if the target cannot be reserved, an update target is not\n    ///                                  the exact published object, or another draft is open\n    private ServerModpackRemoteInstallTask(\n            DefaultDependencyManager dependencyManager,\n            ServerModpackManifest manifest,\n            GameInstanceID instanceId,\n            @Nullable DefaultGameInstance updateTarget) {\n        this.instanceId = instanceId;\n        this.updateTarget = updateTarget;\n        this.dependency = dependencyManager;\n        this.repository = dependencyManager.getGameRepository();\n        this.manifest = manifest;\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        try {\n            if (this.updateTarget != null && Files.exists(json)) {\n                @Nullable ModpackConfiguration<ServerModpackManifest> config = JsonUtils.fromJsonFile(json, ModpackConfiguration.typeOf(ServerModpackManifest.class));\n\n                if (config == null || !MODPACK_TYPE.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        try (GameBuilder builder = this.updateTarget == null\n                ? dependencyManager.newGameBuilder(instanceId)","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/server/ServerModpackRemoteInstallTask.java#L84-L120","documentation":"Thrown by the ServerModpackRemoteInstallTask constructor when an update was requested (updateTarget != null) but the target instance has no modpack configuration file, i.e. it is not a Server modpack instance. Only instances originally installed from a server modpack can be remotely updated.","triggerScenarios":"Constructing ServerModpackRemoteInstallTask with non-null updateTarget for an instanceId whose modpack configuration file does not exist in the repository layout.","commonSituations":"Attempting a server modpack update against a vanilla or non-modpack instance; wrong instance selected in the update dialog; the instance's modpack configuration was deleted.","solutions":["Install the server modpack as a new instance (updateTarget = null) instead of updating.","Select the instance that was originally installed from a Server modpack.","If the configuration file was lost, reinstall the modpack."],"exampleFix":"// before: update on non-modpack instance\nnew ServerModpackRemoteInstallTask(depMgr, vanillaInstanceId, manifest, updateTarget);\n// after: fresh install\nnew ServerModpackRemoteInstallTask(depMgr, newInstanceId, manifest, null);","handlingStrategy":"validation","validationCode":"Path json = repository.getLayout().getModpackConfigurationFile(instanceId);\nboolean canUpdate = updateTarget == null || Files.exists(json);","typeGuard":null,"tryCatchPattern":"try {\n    new ServerModpackRemoteInstallTask(depMgr, instanceId, manifest, updateTarget);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Instance \")) {\n        // install as a new instance instead\n    }\n}","preventionTips":["Only update instances originally installed from a Server modpack.","Keep the instance's modpack configuration file intact.","Check configuration existence before launching an update."],"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"}