{"record":{"id":"937b7a3cdcac5487","repo":"HMCL-dev/HMCL","slug":"instance-is-not-a-curse-modpack-cannot-update-th","errorCode":null,"errorMessage":"Instance  is not a Curse modpack. Cannot update this instance.","messagePattern":"Instance  is not a Curse modpack\\. Cannot update this instance\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/curse/CurseInstallTask.java","lineNumber":147,"sourceCode":"            Modpack modpack,\n            CurseManifest 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\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 Curse modpack. Cannot update this instance.\");\n\n        @Nullable ModpackConfiguration<CurseManifest> config = null;\n        try {\n            if (this.updateTarget != null && Files.exists(json)) {\n                config = JsonUtils.fromJsonFile(json, ModpackConfiguration.typeOf(CurseManifest.class));\n\n                if (config == null || !CurseModpackProvider.INSTANCE.getName().equals(config.getType()))\n                    throw new IllegalArgumentException(\"Instance \" + instanceId + \" is not a Curse 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":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/curse/CurseInstallTask.java#L129-L165","documentation":"CurseInstallTask's constructor throws IllegalArgumentException when an update (updateTarget != null) is requested for an instance that has no Curse modpack configuration file on disk. Updating only makes sense for instances originally installed from a Curse modpack.","triggerScenarios":"Creating a CurseInstallTask with a non-null updateTarget for an instanceId whose getModpackConfigurationFile(instanceId) JSON does not exist (Files.notExists).","commonSituations":"Pointing an update at an instance installed from a plain zip/vanilla install or from a different modpack provider (Mcbbs, etc.), or the user deleted modpack.json from the instance root.","solutions":["Reinstall the modpack fresh instead of using the update path","Verify the instance was originally installed as a Curse modpack (modpack configuration file present)","Point the update at the correct instance ID that contains the Curse configuration"],"exampleFix":"// before\nnew CurseInstallTask(dependencyManager, profile, someVanillaInstanceId, null, version, updateTarget); // updateTarget set, no config file\n// after\nnew CurseInstallTask(dependencyManager, profile, curseInstanceId, null, version, null); // fresh install, or use the actual Curse instance ID","handlingStrategy":"validation","validationCode":"Path json = repository.getLayout().getModpackConfigurationFile(instanceId);\nif (updateTarget != null && Files.notExists(json)) { /* refuse to update: not a modpack instance */ }","typeGuard":"boolean isCurseInstance(GameRepository repo, String id) { return Files.exists(repo.getLayout().getModpackConfigurationFile(id)); }","tryCatchPattern":"try { new CurseInstallTask(...); } catch (IllegalArgumentException e) { /* fall back to fresh install */ }","preventionTips":["Only pass updateTarget for instances created from Curse modpacks","Check for the modpack configuration file before enabling the update UI","Never delete modpack.json from instance roots if updates are desired"],"tags":["modpack","curseforge","illegal-argument"],"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"}