{"record":{"id":"87bab4d983e3642c","repo":"HMCL-dev/HMCL","slug":"fileinformation-missing-path","errorCode":null,"errorMessage":"FileInformation missing `path`.","messagePattern":"FileInformation missing `path`\\.","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/ModpackConfiguration.java","lineNumber":137,"sourceCode":"         *\n         * @return the relative path to Minecraft run directory.\n         */\n        public String getPath() {\n            return path;\n        }\n\n        public String getDownloadURL() {\n            return downloadURL;\n        }\n\n        public String getHash() {\n            return hash;\n        }\n\n        @Override\n        public void validate() throws JsonParseException {\n            if (path == null)\n                throw new JsonParseException(\"FileInformation missing `path`.\");\n            if (hash == null)\n                throw new JsonParseException(\"FileInformation missing file hash code.\");\n        }\n    }\n}\n","sourceCodeStart":119,"sourceCodeEnd":143,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/ModpackConfiguration.java#L119-L143","documentation":"HMCL's ModpackConfiguration.FileInformation.validate() throws JsonParseException when a file entry in a modpack configuration JSON lacks the required `path` field. Every file entry must state its relative path so HMCL knows where to place/verify it. This is a strict schema check run during modpack install/update.","triggerScenarios":"Parsing a modpack configuration JSON (modpack.cfg-style) whose files[] entry has a null/missing `path` field, then calling validate() on the deserialized FileInformation.","commonSituations":"Hand-edited or third-party-generated modpack config files, partially written/corrupted config JSON, or a modpack format change where the field was renamed.","solutions":["Fix the modpack configuration JSON so every files[] entry has a non-null `path`","Re-download/re-export the modpack to regenerate a valid configuration file","Regenerate FileInformation objects programmatically ensuring path is set before validate()"],"exampleFix":"// before\n{\"files\":[{\"hash\":\"abc123\"}]}\n// after\n{\"files\":[{\"path\":\"mods/foo.jar\",\"hash\":\"abc123\"}]}","handlingStrategy":"validation","validationCode":"if (info.getPath() == null) throw new IllegalArgumentException(\"FileInformation entry missing path: \" + info);\nfor (FileInformation f : config.getFiles()) { if (f.getPath() == null || f.getHash() == null) { /* repair or reject */ } }","typeGuard":"boolean isValid(FileInformation f) { return f != null && f.getPath() != null && f.getHash() != null; }","tryCatchPattern":"try { fileInformation.validate(); } catch (JsonParseException e) { log.error(\"Bad modpack file entry\", e); /* skip or reinstall */ }","preventionTips":["Validate modpack configuration JSON before shipping it","Never hand-edit modpack config files; re-export instead","Round-trip parse+validate exports in CI"],"tags":["modpack","json","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"}