{"record":{"id":"8d317d3fbbb48196","repo":"alibaba/nacos","slug":"10000-8d317d","errorCode":"10000","errorMessage":"Raft command is required.","messagePattern":"Raft command is required\\.","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"warning","filePath":"core/src/main/java/com/alibaba/nacos/core/model/form/v3/RaftCommandForm.java","lineNumber":54,"sourceCode":"    /**\n     * Target raft group id, If null or empty, will do command for all group.\n     */\n    private String groupId;\n    \n    /**\n     * Raft command. Valid values:  \"transferLeader\", \"doSnapshot\", \"resetRaftCluster\", \"removePeer\".\n     */\n    private String command;\n    \n    /**\n     * Command value. The format: {raft_server_ip}:{raft_port}[,{raft_server_ip}:{raft_port}]\n     */\n    private String value;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        if (StringUtils.isBlank(command)) {\n            throw new NacosApiException(NacosApiException.INVALID_PARAM,\n                ErrorCode.PARAMETER_MISSING,\n                \"Raft command is required.\");\n        }\n        if (StringUtils.isBlank(value)) {\n            throw new NacosApiException(NacosApiException.INVALID_PARAM,\n                ErrorCode.PARAMETER_MISSING,\n                \"Raft command value is required.\");\n        }\n    }\n    \n    public String getGroupId() {\n        return groupId;\n    }\n    \n    public void setGroupId(String groupId) {\n        this.groupId = groupId;\n    }\n    ","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/core/src/main/java/com/alibaba/nacos/core/model/form/v3/RaftCommandForm.java#L36-L72","documentation":"RaftCommandForm.validate() requires a non-blank `command` for the cluster Raft ops API (POST /v3/admin/core/ops/raft). It throws NacosApiException HTTP 400 / ErrorCode.PARAMETER_MISSING (10000). Valid command values are transferLeader, doSnapshot, resetRaftCluster, removePeer (enforced later by the CP protocol).","triggerScenarios":"POST /v3/admin/core/ops/raft with a JSON body missing the \"command\" field, or with \"command\": \"\" / null. The @RequestBody form is bound and validate() throws before the protocol manager runs.","commonSituations":"Malformed JSON body; copy-pasting the docs example and dropping the command field; serializing the wrong object shape (e.g. sending {cmd: ...} instead of {command: ...}).","solutions":["Include the \"command\" field with one of: transferLeader, doSnapshot, resetRaftCluster, removePeer.","Verify the JSON key is exactly \"command\" and the value is non-blank.","Re-check the request body Content-Type is application/json."],"exampleFix":"// before\nPOST /v3/admin/core/ops/raft\n{\"groupId\":\"nacos_config\",\"value\":\"1.2.3.4:7848\"}\n// after\nPOST /v3/admin/core/ops/raft\n{\"groupId\":\"nacos_config\",\"command\":\"doSnapshot\",\"value\":\"1.2.3.4:7848\"}","handlingStrategy":"validation","validationCode":"Set<String> valid = Set.of(\"transferLeader\",\"doSnapshot\",\"resetRaftCluster\",\"removePeer\");\nif (command == null || command.isBlank() || !valid.contains(command)) {\n    throw new IllegalArgumentException(\"raft command must be one of \" + valid);\n}\n// then POST /v3/admin/core/ops/raft with {\"groupId\":..,\"command\":command,\"value\":value}","typeGuard":null,"tryCatchPattern":"try {\n    raftClient.raftOps(groupId, command, value);\n} catch (NacosApiException e) {\n    if (e.getErrCode() == 10000 && e.getMessage().contains(\"command\")) {\n        // command field missing/blank -> set it and retry\n    } else { throw e; }\n}","preventionTips":["Always send the \"command\" field with an exact documented value.","Validate the command against the 4 allowed values before sending.","Use application/json Content-Type for the @RequestBody form."],"tags":["raft","cluster-ops","validation","admin-api"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}