{"record":{"id":"2e3bee55619125b6","repo":"HMCL-dev/HMCL","slug":"servermodpackmanifest-files-cannot-be-null","errorCode":null,"errorMessage":"ServerModpackManifest.files cannot be null","messagePattern":"ServerModpackManifest\\.files cannot be null","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/server/ServerModpackManifest.java","lineNumber":99,"sourceCode":"    public List<ModpackConfiguration.FileInformation> getFiles() {\n        return files;\n    }\n\n    public List<Addon> getAddons() {\n        return addons;\n    }\n\n    @Override\n    public ModpackProvider getProvider() {\n        return ServerModpackProvider.INSTANCE;\n    }\n\n    @Override\n    public void validate() throws JsonParseException, TolerableValidationException {\n        if (fileApi == null)\n            throw new JsonParseException(\"ServerModpackManifest.fileApi cannot be blank\");\n        if (files == null)\n            throw new JsonParseException(\"ServerModpackManifest.files cannot be null\");\n    }\n\n    public static final class Addon {\n        private final String id;\n        private final String version;\n\n        public Addon() {\n            this(\"\", \"\");\n        }\n\n        public Addon(String id, String version) {\n            this.id = id;\n            this.version = version;\n        }\n\n        public String getId() {\n            return id;\n        }","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/server/ServerModpackManifest.java#L81-L117","documentation":"Validation error thrown when a server modpack manifest (modpack.json) lacks the 'files' array. The manifest must list every file of the pack; without it the client cannot know what to download, so the manifest is rejected.","triggerScenarios":"ServerModpackManifest.validate() runs after deserialization and the 'files' key is absent or null in the manifest JSON.","commonSituations":"Manually crafted manifests missing the files list; broken manifest generators; corrupted/partial downloads of modpack.json.","solutions":["Add a 'files' array with FileInformation entries (path, hash, size) to the manifest.","Regenerate the manifest with the HMCL server modpack export task or a maintained tool.","Re-download modpack.json if the local copy is truncated or corrupted."],"exampleFix":"// before\n{ \"fileApi\": \"https://example.com/files\" }\n// after\n{ \"fileApi\": \"https://example.com/files\", \"files\": [{\"path\": \"mods/a.jar\", \"hash\": \"...\", \"size\": 123}] }","handlingStrategy":"validation","validationCode":"JsonObject manifest = JsonUtils.fromJson(json, JsonObject.class);\nif (!manifest.has(\"files\") || !manifest.get(\"files\").isJsonArray())\n    throw new JsonParseException(\"manifest missing files\");","typeGuard":null,"tryCatchPattern":"try {\n    manifest.validate();\n} catch (JsonParseException e) {\n    if (e.getMessage().contains(\"files cannot be null\")) {\n        // regenerate or re-download the manifest\n    }\n}","preventionTips":["Generate manifests with the official export tool so 'files' is always present.","Validate the manifest JSON schema server-side before serving it.","Verify download integrity (size/checksum) of modpack.json."],"tags":["modpack","json","validation","missing-field"],"backgroundTag":"schema-validation-failed","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"}