alibaba/nacos · warning · NacosApiException

10000

10000

Error message

Raft command is required.

What it means

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).

Source

Thrown at core/src/main/java/com/alibaba/nacos/core/model/form/v3/RaftCommandForm.java:54

    /**
     * Target raft group id, If null or empty, will do command for all group.
     */
    private String groupId;
    
    /**
     * Raft command. Valid values:  "transferLeader", "doSnapshot", "resetRaftCluster", "removePeer".
     */
    private String command;
    
    /**
     * Command value. The format: {raft_server_ip}:{raft_port}[,{raft_server_ip}:{raft_port}]
     */
    private String value;
    
    @Override
    public void validate() throws NacosApiException {
        if (StringUtils.isBlank(command)) {
            throw new NacosApiException(NacosApiException.INVALID_PARAM,
                ErrorCode.PARAMETER_MISSING,
                "Raft command is required.");
        }
        if (StringUtils.isBlank(value)) {
            throw new NacosApiException(NacosApiException.INVALID_PARAM,
                ErrorCode.PARAMETER_MISSING,
                "Raft command value is required.");
        }
    }
    
    public String getGroupId() {
        return groupId;
    }
    
    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }
    

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Include the "command" field with one of: transferLeader, doSnapshot, resetRaftCluster, removePeer.
  2. Verify the JSON key is exactly "command" and the value is non-blank.
  3. Re-check the request body Content-Type is application/json.

Example fix

// before
POST /v3/admin/core/ops/raft
{"groupId":"nacos_config","value":"1.2.3.4:7848"}
// after
POST /v3/admin/core/ops/raft
{"groupId":"nacos_config","command":"doSnapshot","value":"1.2.3.4:7848"}
Defensive patterns

Strategy: validation

Validate before calling

Set<String> valid = Set.of("transferLeader","doSnapshot","resetRaftCluster","removePeer");
if (command == null || command.isBlank() || !valid.contains(command)) {
    throw new IllegalArgumentException("raft command must be one of " + valid);
}
// then POST /v3/admin/core/ops/raft with {"groupId":..,"command":command,"value":value}

Try / catch

try {
    raftClient.raftOps(groupId, command, value);
} catch (NacosApiException e) {
    if (e.getErrCode() == 10000 && e.getMessage().contains("command")) {
        // command field missing/blank -> set it and retry
    } else { throw e; }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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: ...}).

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/8d317d3fbbb48196. Report an issue: GitHub.