{"record":{"id":"3c09b852baead9d4","repo":"HMCL-dev/HMCL","slug":"instance-3c09b8","errorCode":null,"errorMessage":"Instance ","messagePattern":"Instance ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/modrinth/ModrinthInstallTask.java","lineNumber":144,"sourceCode":"            Path zipFile,\n            Modpack modpack,\n            ModrinthManifest manifest,\n            GameInstanceID instanceId,\n            @Nullable DefaultGameInstance updateTarget,\n            @Nullable String iconUrl) {\n        this.dependencyManager = dependencyManager;\n        this.zipFile = zipFile;\n        this.modpack = modpack;\n        this.manifest = manifest;\n        this.instanceId = instanceId;\n        this.updateTarget = updateTarget;\n        this.iconUrl = iconUrl;\n        this.repository = dependencyManager.getGameRepository();\n        this.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 Modrinth modpack. Cannot update this instance.\");\n\n        @Nullable ModpackConfiguration<ModrinthManifest> config = null;\n        try {\n            if (this.updateTarget != null && Files.exists(json)) {\n                config = JsonUtils.fromJsonFile(json, ModpackConfiguration.typeOf(ModrinthManifest.class));\n\n                if (config == null || !ModrinthModpackProvider.INSTANCE.getName().equals(config.getType()))\n                    throw new IllegalArgumentException(\"Instance \" + instanceId + \" is not a Modrinth modpack. Cannot update this instance.\");\n            }\n        } catch (JsonParseException | IOException ignore) {\n        }\n        this.config = config;\n\n        onDone().register(event -> {\n            @Nullable Exception ex = event.getTask().getException();\n            if (this.updateTarget == null && event.isFailed()) {\n                if (!(ex instanceof ModpackCompletionException)) {\n                    repository.removeInstanceFromDisk(instanceId);","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/modrinth/ModrinthInstallTask.java#L126-L162","documentation":"Thrown by the ModrinthInstallTask constructor when an update is requested (updateTarget != null) but the target instance directory has no modpack configuration file, meaning the instance was not originally installed as a Modrinth modpack. The task only supports updating instances it can re-resolve via a stored Modrinth ModpackConfiguration.","triggerScenarios":"Calling new ModrinthInstallTask(...) with a non-null updateTarget for an instanceId whose modpackConfiguration JSON file does not exist under the instance root.","commonSituations":"User selects 'update' on a manually created instance or an instance imported from another launcher (vanilla, CurseForge, MultiMC), then HMCL tries to treat it as a Modrinth pack.","solutions":["Install the instance as a Modrinth modpack first so the modpack configuration file is created, then update","Pass null updateTarget to perform a fresh install instead of an update","Verify the instanceId points at an existing Modrinth-managed instance in the game repository"],"exampleFix":"// before\nnew ModrinthInstallTask(dependencyManager, someNonModrinthInstance, modpack, null); // updateTarget set on non-modrinth instance\n// after\nnew ModrinthInstallTask(dependencyManager, null, modpack, null); // fresh install","handlingStrategy":"validation","validationCode":"Path json = repository.getLayout().getModpackConfigurationFile(instanceId);\nif (updateTarget != null && Files.notExists(json)) throw new IllegalStateException(instanceId + \" is not a Modrinth modpack\");","typeGuard":null,"tryCatchPattern":"try { new ModrinthInstallTask(...).start(); } catch (IllegalArgumentException e) { /* fall back to fresh install */ }","preventionTips":["Only pass updateTarget for instances originally installed from a Modrinth pack","Check for the modpack configuration file before requesting an update"],"tags":["modrinth","modpack","instance-state","illegal-argument"],"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"}