apache/hadoop · error · IllegalArgumentException

RPC version is expected to be 2 but got {}

Error message

RPC version is expected to be 2 but got {}

What it means

Error "RPC version is expected to be 2 but got {}" thrown in apache/hadoop.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java:70

  protected RpcCall(int xid, RpcMessage.Type messageType, int rpcVersion,
      int program, int version, int procedure, Credentials credential,
      Verifier verifier) {
    super(xid, messageType);
    this.rpcVersion = rpcVersion;
    this.program = program;
    this.version = version;
    this.procedure = procedure;
    this.credentials = credential;
    this.verifier = verifier;
    if (LOG.isTraceEnabled()) {
      LOG.trace(this.toString());
    }
    validate();
  }

  private void validateRpcVersion() {
    if (rpcVersion != RPC_VERSION) {
      throw new IllegalArgumentException("RPC version is expected to be "
          + RPC_VERSION + " but got " + rpcVersion);
    }
  }

  public void validate() {
    validateMessageType(RpcMessage.Type.RPC_CALL);
    validateRpcVersion();
    // Validate other members
    // Throw exception if validation fails
  }


  public int getRpcVersion() {
    return rpcVersion;
  }

  public int getProgram() {
    return program;

View on GitHub (pinned to 2add963021)

Solutions

  1. Ensure the client and server both speak ONC RPC version 2; upgrade or align mismatched Hadoop/NFS component versions.
  2. Check for non-RPC traffic or port confusion on the RPC port (e.g. another service bound to the port).
  3. Verify the request bytes are not corrupted; inspect network capture if the problem persists.

When it happens

Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java:70 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/a772e5ba85e77e85. Report an issue: GitHub.