{"record":{"id":"4e11fd8abac9f1e9","repo":"apache/hadoop","slug":"non-sasl-response-during-negotiation","errorCode":null,"errorMessage":"Non-SASL response during negotiation","messagePattern":"Non-SASL response during negotiation","errorType":"exception","errorClass":"SaslException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java","lineNumber":388,"sourceCode":"\n    sendSaslMessage(ipcStreams.out, negotiateRequest);\n    // loop until sasl is complete or a rpc error occurs\n    boolean done = false;\n    do {\n      ByteBuffer bb = ipcStreams.readResponse();\n\n      RpcWritable.Buffer saslPacket = RpcWritable.Buffer.wrap(bb);\n      RpcResponseHeaderProto header =\n          saslPacket.getValue(RpcResponseHeaderProto.getDefaultInstance());\n      switch (header.getStatus()) {\n        case ERROR: // might get a RPC error during \n        case FATAL:\n          throw new RemoteException(header.getExceptionClassName(),\n                                    header.getErrorMsg());\n        default: break;\n      }\n      if (header.getCallId() != AuthProtocol.SASL.callId) {\n        throw new SaslException(\"Non-SASL response during negotiation\");\n      }\n      RpcSaslProto saslMessage =\n          saslPacket.getValue(RpcSaslProto.getDefaultInstance());\n      if (saslPacket.remaining() > 0) {\n        throw new SaslException(\"Received malformed response length\");\n      }\n      // handle sasl negotiation process\n      RpcSaslProto.Builder response = null;\n      switch (saslMessage.getState()) {\n        case NEGOTIATE: {\n          // create a compatible SASL client, throws if no supported auths\n          SaslAuth saslAuthType = selectSaslClient(saslMessage.getAuthsList());\n          // define auth being attempted, caller can query if connect fails\n          authMethod = AuthMethod.valueOf(saslAuthType.getMethod());\n          \n          byte[] responseToken = null;\n          if (authMethod == AuthMethod.SIMPLE) { // switching to SIMPLE\n            done = true; // not going to wait for success ack","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java#L370-L406","documentation":"During SASL negotiation the response packet's callId was not the SASL call id, meaning a non-SASL RPC response arrived while the connection was still in SASL handshake state — the stream is out of sync or misframed.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java:388 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify both endpoints are performing SASL negotiation; a non-SASL response suggests the server rejected or does not support SASL.","Check that hadoop.security.authentication and rpc protection settings match on client and server.","Look for version incompatibilities or middleboxes interfering with the RPC stream."],"exampleFix":null,"handlingStrategy":"try-catch","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"}