{"record":{"id":"0825a9201a03849a","repo":"HMCL-dev/HMCL","slug":"neoforgeversion-version-cannot-be-null","errorCode":null,"errorMessage":"NeoForgeVersion version cannot be null.","messagePattern":"NeoForgeVersion version cannot be null\\.","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeBMCLVersionList.java","lineNumber":103,"sourceCode":"\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":85,"sourceCodeEnd":111,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/download/neoforge/NeoForgeBMCLVersionList.java#L85-L111","documentation":"Same validate() chain as the rawVersion check: the normalized `version` field of a NeoForgeVersion entry must be non-null. This is the cleaned version string HMCL actually exposes; if absent, the entry is malformed and a JsonParseException is thrown.","triggerScenarios":"A BMCLAPI NeoForge metadata entry with a rawVersion but no parsed/normalized version field, encountered while validating entries during NeoForge version list load.","commonSituations":"Mirror metadata with partially filled fields; schema changes in BMCLAPI response format; corrupted/truncated cached version list.","solutions":["Clear cache and refresh the NeoForge version list.","Switch metadata mirror or use the official source in download settings.","Retry later if the mirror is populating a new release.","Update HMCL to handle the new metadata schema."],"exampleFix":"// before: trusting list entries blindly\n// after:\nif (version.getVersion() == null) continue; // skip malformed entries instead of crashing","handlingStrategy":"try-catch","validationCode":"for (JsonObject e : entries) if (e.get(\"version\") == null || e.get(\"version\").isJsonNull()) skip();","typeGuard":"if (version.getVersion() == null) continue;","tryCatchPattern":"try { entries.forEach(NeoForgeVersion::validate); }\ncatch (JsonParseException e) { LOG.warning(\"Skipping malformed NeoForge entry\", e); }","preventionTips":["Filter out entries with null normalized version before use.","Refresh from the official source when mirror data is partial.","Retry list loads a short time after a new NeoForge release."],"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"}