{"record":{"id":"5aa1733fabf26c9d","repo":"HMCL-dev/HMCL","slug":"neoforgeversion-rawversion-cannot-be-null","errorCode":null,"errorMessage":"NeoForgeVersion rawVersion cannot be null.","messagePattern":"NeoForgeVersion rawVersion cannot be null\\.","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeBMCLVersionList.java","lineNumber":100,"sourceCode":"    @Immutable\n    private static final class NeoForgeVersion implements Validation {\n        private final String rawVersion;\n\n        private final String version;\n\n        @SerializedName(\"mcversion\")\n        private final String mcVersion;\n\n        public NeoForgeVersion(String rawVersion, String version, String mcVersion) {\n            this.rawVersion = rawVersion;\n            this.version = version;\n            this.mcVersion = mcVersion;\n        }\n\n        @Override\n        public void validate() throws JsonParseException {\n            if (this.rawVersion == null) {\n                throw new JsonParseException(\"NeoForgeVersion rawVersion cannot be null.\");\n            }\n            if (this.version == null) {\n                throw new JsonParseException(\"NeoForgeVersion version cannot be null.\");\n            }\n            if (this.mcVersion == null) {\n                throw new JsonParseException(\"NeoForgeVersion mcversion cannot be null.\");\n            }\n        }\n    }\n}\n","sourceCodeStart":82,"sourceCodeEnd":111,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeBMCLVersionList.java#L82-L111","documentation":"NeoForgeBMCLVersionList's inner NeoForgeVersion model represents one NeoForge version entry from the BMCLAPI metadata. validate() rejects entries whose rawVersion (the server-reported version string) is null, throwing JsonParseException so a malformed metadata record never becomes a usable RemoteVersion.","triggerScenarios":"Deserializing a BMCLAPI NeoForge metadata JSON entry that is missing the raw version field, then calling validate() while loading the NeoForge version list for a given Minecraft version.","commonSituations":"BMCLAPI/mirror returning incomplete or schema-drifted metadata; a truncated API response; a newly published entry that hasn't been fully populated on the mirror yet.","solutions":["Refresh the NeoForge version list (clear mirror cache) to re-fetch complete metadata.","Switch to a different metadata source/mirror (or the official maven) in download settings.","Retry later if the mirror is mid-sync for a new NeoForge release.","Update HMCL if the BMCLAPI schema changed and needs newer parsing code."],"exampleFix":"// Not caller-fixable; guard at usage:\ntry {\n    versionList.loadVersions(mcVersion);\n} catch (JsonParseException e) {\n    LOG.warning(\"Malformed NeoForge metadata from mirror\", e); // retry or switch mirror\n}","handlingStrategy":"try-catch","validationCode":"// Inspect mirror metadata before loading versions\nif (metadataJson == null || !metadataJson.has(\"versions\")) { switchMirror(); }","typeGuard":"if (version.getRawVersion() == null) { skipEntry(); }","tryCatchPattern":"try { list = versionList.loadVersions(mcVersion); }\ncatch (JsonParseException e) { LOG.warning(\"Malformed NeoForge metadata\", e); list = versionList.loadVersionsFromOfficial(mcVersion); }","preventionTips":["Pin to a reliable mirror and refresh metadata after new NeoForge releases.","Clear the version-list cache when entries look incomplete.","Keep HMCL updated against BMCLAPI schema changes."],"tags":["json","validation","neoforge","mirror"],"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-23T08:17:48.524Z"}