{"record":{"id":"c53d65372d0dd960","repo":"HMCL-dev/HMCL","slug":"unsupported-icon-file","errorCode":null,"errorMessage":"Unsupported icon file: ","messagePattern":"Unsupported icon file: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameInstance.java","lineNumber":356,"sourceCode":"            Path file = getInstanceRoot().resolve(\"icon.\" + extension);\n            if (Files.exists(file)) {\n                return file;\n            }\n        }\n        return null;\n    }\n\n    /// Replaces this instance's custom icon file.\n    ///\n    /// Existing supported icon files are removed before `iconFile` is copied.\n    ///\n    /// @param iconFile the source icon file\n    /// @throws IOException              if the icon cannot be copied\n    /// @throws IllegalArgumentException if the file extension is unsupported\n    public void setIconFile(Path iconFile) throws IOException {\n        String extension = FileUtils.getExtension(iconFile).toLowerCase(Locale.ROOT);\n        if (!FXUtils.IMAGE_EXTENSIONS.contains(extension)) {\n            throw new IllegalArgumentException(\"Unsupported icon file: \" + extension);\n        }\n\n        clearIconFiles();\n        FileUtils.copyFile(iconFile, getInstanceRoot().resolve(\"icon.\" + extension));\n        invalidateIconImage();\n    }\n\n    /// Deletes all supported custom icon files for this instance.\n    ///\n    /// Individual deletion failures are logged and do not stop later files from being attempted.\n    public void deleteIconFile() {\n        clearIconFiles();\n        invalidateIconImage();\n    }\n\n    private void clearIconFiles() {\n        for (String extension : FXUtils.IMAGE_EXTENSIONS) {\n            Path file = getInstanceRoot().resolve(\"icon.\" + extension);","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameInstance.java#L338-L374","documentation":"Thrown from the McbbsModpackLocalInstallTask constructor when an update (updateTarget != null) is requested but no modpack configuration file (modpack.cfg-style JSON) exists for the instance. An instance without that file was never installed from an Mcbbs modpack, so updating it as one is invalid.","triggerScenarios":"new McbbsModpackLocalInstallTask(..., updateTarget=<non-null>, instanceId=<id>) where repository.getLayout().getModpackConfigurationFile(instanceId) does not exist on disk.","commonSituations":"Attempting to update an instance installed manually or from a different modpack format; pointing the update task at the wrong instanceId; the configuration file was deleted.","solutions":["Pass updateTarget = null to perform a fresh install instead of an update","Verify the instanceId refers to an instance actually installed from an Mcbbs modpack","Check that modpack.cfg (the modpack configuration file) still exists in the instance directory","Reinstall the modpack from scratch into the instance"],"exampleFix":"// before (update on non-modpack instance)\nnew McbbsModpackLocalInstallTask(dm, instanceId, manifest, updateTarget);\n// after: install fresh when no config exists\nif (Files.notExists(configFile)) updateTarget = null;","handlingStrategy":"validation","validationCode":"Path json = repository.getLayout().getModpackConfigurationFile(instanceId);\nif (updateTarget != null && Files.notExists(json))\n    updateTarget = null; // fall back to fresh install","typeGuard":"boolean isMcbbsInstance = Files.exists(configFile);","tryCatchPattern":"try { new McbbsModpackLocalInstallTask(...); } catch (IllegalArgumentException e) { /* fall back to fresh install */ }","preventionTips":["Only update instances you installed via this provider","Never delete modpack.cfg from instance directories","Match instanceId to the pack's original install"],"tags":["modpack","update","instance"],"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"}