{"record":{"id":"5b0df33a2b2a2e4d","repo":"HMCL-dev/HMCL","slug":"ruledarguments-instance-does-not-have-either-value","errorCode":null,"errorMessage":"RuledArguments instance does not have either value or values member.","messagePattern":"RuledArguments instance does not have either value or values member\\.","errorType":"validation","errorClass":"JsonParseException","httpStatus":null,"severity":"error","filePath":"HMCLCore/src/main/java/org/jackhuang/hmcl/game/RuledArgument.java","lineNumber":92,"sourceCode":"JsonElement valuesElement;\nif (obj.has(\"values\")) {\n    valuesElement = obj.get(\"values\");\n} else if (obj.has(\"value\")) {\n    valuesElement = obj.get(\"value\");\n} else {\n    throw new JsonParseException(\"RuledArguments instance does not have either value or values member.\");\n}\n\nList<String> values;\nif (valuesElement.isJsonPrimitive()) {\n    values = Collections.singletonList(valuesElement.getAsString());\n} else {\n    values = context.deserialize(valuesElement, listTypeOf(String.class).getType());\n}\n\nreturn new RuledArgument(rules, values);","sourceCodeStart":74,"sourceCodeEnd":107,"githubUrl":"https://github.com/HMCL-dev/HMCL/blob/24702dc5a0214034f4c27166d5fd30cad08cec19/HMCLCore/src/main/java/org/jackhuang/hmcl/game/RuledArgument.java#L74-L107","documentation":"Fired in the Gson deserializer for Minecraft's rules-conditional arguments when a JSON object contains neither 'value' nor 'values'. Such an arguments entry cannot be interpreted, so deserialization of the version JSON fails.","triggerScenarios":"Deserializing a Minecraft version JSON 'arguments'/'rules' block where an object contains only 'rules' (or other keys) but no value/values key.","commonSituations":"Hand-modified version JSON, third-party mod-loader manifests with malformed argument rules, schema drift between launcher versions.","solutions":["Add a 'value' or 'values' member to the offending argument object in the version JSON","Obtain an intact version JSON from the official manifest or the mod loader's official repo","Remove the malformed argument object if it is obsolete","Pre-validate the JSON with a schema check that enforces value/values presence"],"exampleFix":"// before\n{\"rules\": [{\"action\": \"allow\", \"os\": {\"name\": \"osx\"}}]}\n// after\n{\"rules\": [{\"action\": \"allow\", \"os\": {\"name\": \"osx\"}}], \"value\": \"-XstartOnFirstThread\"}","handlingStrategy":"try-catch","validationCode":"static boolean hasValueOrValues(JsonObject rule) {\n    return rule.has(\"value\") || rule.has(\"values\");\n}\n// assert every argument object in the version JSON passes before deserialization","typeGuard":"static boolean isRuledArgumentUsable(JsonElement el) {\n    if (!el.isJsonObject()) return false;\n    JsonObject o = el.getAsJsonObject();\n    return o.has(\"value\") || o.has(\"values\");\n}","tryCatchPattern":"try {\n    JsonParser.parseRuledArgument(obj);\n} catch (JsonParseException e) {\n    if (e.getMessage().contains(\"value or values member\")) {\n        // skip entry or fetch a repaired version JSON\n    } else throw e;\n}","preventionTips":["Validate version JSON against the launcher schema first","Never strip 'empty-looking' value fields from argument rules","Diff third-party manifests against official ones before use"],"tags":["json","deserialization","minecraft"],"backgroundTag":"json-unmarshal-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"}