{"record":{"id":"67f7ad26e741a125","repo":"HMCL-dev/HMCL","slug":"assets","errorCode":null,"errorMessage":"/assets/","messagePattern":"/assets/","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameLauncher.java","lineNumber":202,"sourceCode":"\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        }\n\n        if (Files.isRegularFile(agentPath)) {\n            try {\n                if (Files.size(agentPath) == bytes.length) {\n                    return agentPath;\n                }\n            } catch (IOException e) {\n                LOG.warning(\"Failed to check size of \" + agentPath, e);\n            }\n        }\n\n        Files.createDirectories(agentPath.getParent());\n        FileUtils.saveSafely(agentPath, output -> output.write(bytes));\n        return agentPath;","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameLauncher.java#L184-L220","documentation":"Validation failure: an Mcbbs modpack manifest must declare a non-null files array listing every file in the pack. A manifest without files cannot be installed or completed, so validate() rejects it with JsonParseException.","triggerScenarios":"Importing an Mcbbs pack whose manifest JSON lacks the \"files\" field or has it explicitly null.","commonSituations":"Hand-crafted or minimal manifests missing the files section; packs exported by broken tools; manifests for server-side-only packs with files omitted instead of an empty array.","solutions":["Add a \"files\" array (possibly empty []) to the manifest JSON","Re-export/re-download the modpack with a spec-compliant tool","Validate the manifest against the Mcbbs modpack spec before importing"],"exampleFix":"// before\n{\"manifestType\": \"minecraftModpack\"}\n// after\n{\"manifestType\": \"minecraftModpack\", \"files\": [], \"addons\": []}","handlingStrategy":"validation","validationCode":"if (!manifest.has(\"files\") || manifest.get(\"files\").isJsonNull())\n    throw new IllegalArgumentException(\"Manifest missing files array\");","typeGuard":null,"tryCatchPattern":"try { manifest.validate(); } catch (JsonParseException e) { /* report missing field to user */ }","preventionTips":["Always emit \"files\": [] even for empty packs","Validate exported manifests against the spec","Test-export a minimal pack with your tool"],"tags":["modpack","manifest","validation"],"backgroundTag":"missing-required-config-field","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"}