{"record":{"id":"6e3c27ce8cc059ca","repo":"apache/hadoop","slug":"received-malformed-response-length","errorCode":null,"errorMessage":"Received malformed response length","messagePattern":"Received malformed response length","errorType":"exception","errorClass":"SaslException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java","lineNumber":393,"sourceCode":"      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\n          } else {\n            byte[] challengeToken = null;\n            if (saslAuthType.hasChallenge()) {\n              // server provided the first challenge\n              challengeToken = saslAuthType.getChallenge().toByteArray();","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java#L375-L411","documentation":"Error \"Received malformed response length\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcClient.java:393 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check for corrupted RPC traffic; the SASL response length could not be parsed.","Verify no non-RPC service or proxy is writing to the connection.","Align client and server versions; persistent failures warrant a packet capture to identify the sender."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}