{"record":{"id":"7e2ee7561eb21cc9","repo":"HMCL-dev/HMCL","slug":"missing-hmcl-lwjgl-unsafe-agent-version-attribute","errorCode":null,"errorMessage":"Missing hmcl.lwjgl-unsafe-agent.version attribute","messagePattern":"Missing hmcl\\.lwjgl-unsafe-agent\\.version attribute","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameLauncher.java","lineNumber":188,"sourceCode":"        super.appendJvmArgs(result);\n\n        if (options.isAllowAutoAgent()\n                && !options.isNoGeneratedJVMArgs()\n                && !options.isNoGeneratedOptimizingJVMArgs()\n                && NativePatcher.needPatchMemoryUtil(manifest, options.getJava().getParsedVersion())) {\n            LOG.info(\"Attempting to patch game with lwjgl-unsafe-agent\");\n            try {\n                result.add(\"-javaagent:\" + extractLwjglUnsafeAgent());\n            } catch (Exception e) {\n                LOG.warning(\"Failed to extract lwjgl-unsafe-agent\", e);\n            }\n        }\n    }\n\n    private Path extractLwjglUnsafeAgent() throws IOException {\n        String agentVersion = JarUtils.getAttribute(\"hmcl.lwjgl-unsafe-agent.version\", null);\n        if (agentVersion == null) {\n            throw new IOException(\"Missing hmcl.lwjgl-unsafe-agent.version attribute\");\n        }\n\n        Library library = new Library(new Artifact(\"org.glavo\", \"lwjgl-unsafe-agent\", agentVersion));\n        String fileName = library.artifact().getFileName();\n\n        Path agentPath = instance.getLayout().getLibraryFile(instance.getId(), library).toAbsolutePath().normalize();\n        if (agentPath.toString().contains(\"=\")) {\n            throw new IOException(\"Invalid library path: \" + agentPath);\n        }\n\n        byte[] bytes;\n        try (InputStream input = DefaultLauncher.class.getResourceAsStream(\"/assets/\" + fileName)) {\n            if (input == null) {\n                throw new IOException(\"/assets/\" + fileName + \" not found\");\n            }\n\n            bytes = input.readAllBytes();\n        }","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameLauncher.java#L170-L206","documentation":"Thrown when updating an instance whose existing modpack configuration JSON declares a different provider type than 'mcbbs'. The task only allows updates within the same modpack format, so an instance installed from e.g. a CurseForge or Modrinth pack cannot be updated as an Mcbbs pack.","triggerScenarios":"new McbbsModpackLocalInstallTask(..., updateTarget=<non-null>) where the existing configuration file parses but config.getType() is not \"mcbbs\" (or config is null despite the file existing).","commonSituations":"Updating an instance that was originally installed from a CurseForge/Modrinth/other pack; the config file was overwritten by another launcher; wrong task/provider chosen for the instance.","solutions":["Use the matching provider (e.g. Modrinth/CurseForge task) for the instance's original modpack type","Pass updateTarget = null to reinstall as a new Mcbbs pack (overwrites)","Check the modpack.cfg type field to confirm which pack format installed the instance","Create a fresh instance and install the Mcbbs pack there"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"ModpackConfiguration<?> config = JsonUtils.fromJsonFile(configFile, ModpackConfiguration.typeOf(Object.class));\nif (config != null && !\"mcbbs\".equals(config.getType()))\n    useProviderFor(config.getType());","typeGuard":"if (config != null && McbbsModpackProvider.INSTANCE.getName().equals(config.getType())) { /* safe */ }","tryCatchPattern":"try { task.execute(); } catch (IllegalArgumentException e) { /* route to provider matching config.getType() */ }","preventionTips":["Check config type field before choosing an update task","Keep one provider per instance","Regenerate config on provider migration"],"tags":["modpack","update","type-mismatch"],"backgroundTag":"type-mismatch","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"}