{"record":{"id":"a772e5ba85e77e85","repo":"apache/hadoop","slug":"rpc-version-is-expected-to-be-2-but-got","errorCode":null,"errorMessage":"RPC version is expected to be 2 but got {}","messagePattern":"RPC version is expected to be 2 but got (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java","lineNumber":70,"sourceCode":"  protected RpcCall(int xid, RpcMessage.Type messageType, int rpcVersion,\n      int program, int version, int procedure, Credentials credential,\n      Verifier verifier) {\n    super(xid, messageType);\n    this.rpcVersion = rpcVersion;\n    this.program = program;\n    this.version = version;\n    this.procedure = procedure;\n    this.credentials = credential;\n    this.verifier = verifier;\n    if (LOG.isTraceEnabled()) {\n      LOG.trace(this.toString());\n    }\n    validate();\n  }\n\n  private void validateRpcVersion() {\n    if (rpcVersion != RPC_VERSION) {\n      throw new IllegalArgumentException(\"RPC version is expected to be \"\n          + RPC_VERSION + \" but got \" + rpcVersion);\n    }\n  }\n\n  public void validate() {\n    validateMessageType(RpcMessage.Type.RPC_CALL);\n    validateRpcVersion();\n    // Validate other members\n    // Throw exception if validation fails\n  }\n\n\n  public int getRpcVersion() {\n    return rpcVersion;\n  }\n\n  public int getProgram() {\n    return program;","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java#L52-L88","documentation":"Validation of an incoming ONC/RPC call: the rpcVersion field of the RPC call header is not 2 (the only supported ONC/RPC protocol version), so the message comes from an incompatible or malformed client and is rejected during RpcCall construction.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java:70 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the client and server both speak ONC RPC version 2; upgrade or align mismatched Hadoop/NFS component versions.","Check for non-RPC traffic or port confusion on the RPC port (e.g. another service bound to the port).","Verify the request bytes are not corrupted; inspect network capture if the problem persists."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}