{"record":{"id":"a07759cb6dd5f5b2","repo":"HMCL-dev/HMCL","slug":"fileinformation-missing-file-hash-code","errorCode":null,"errorMessage":"FileInformation missing file hash code.","messagePattern":"FileInformation missing file hash code\\.","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/ModpackConfiguration.java","lineNumber":139,"sourceCode":"         */\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":121,"sourceCodeEnd":143,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/modpack/ModpackConfiguration.java#L121-L143","documentation":"ModpackConfiguration.FileInformation.validate() throws JsonParseException when a file entry lacks a `hash` value. The hash lets HMCL verify downloaded files against the modpack manifest. Validation enforces both path and hash on every entry.","triggerScenarios":"Deserializing a modpack configuration whose files[] entry has a null `hash`, then calling validate().","commonSituations":"Modpack exported by a tool that omits hashes, truncated or hand-edited config files, or entries manually appended without computing the file hash.","solutions":["Add the correct SHA-1 hash for each file entry in the configuration JSON","Re-export the modpack so hashes are computed automatically","Remove entries whose files no longer exist in the pack"],"exampleFix":"// before\n{\"files\":[{\"path\":\"mods/foo.jar\"}]}\n// after\n{\"files\":[{\"path\":\"mods/foo.jar\",\"hash\":\"1a2b3c...\"}]}","handlingStrategy":"validation","validationCode":"if (info.getHash() == null) throw new IllegalArgumentException(\"FileInformation missing hash: \" + info.getPath());","typeGuard":"boolean hasHash(FileInformation f) { return f != null && f.getHash() != null; }","tryCatchPattern":"try { fileInformation.validate(); } catch (JsonParseException e) { log.error(\"Entry without hash\", e); }","preventionTips":["Always compute file hashes when generating manifests","Validate configuration JSON after every export","Keep modpack export tooling up to date"],"tags":["modpack","json","validation","checksum"],"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"}