{"record":{"id":"f54663f9d9cee795","repo":"grpc/grpc-java","slug":"no-handshaker-response-received","errorCode":null,"errorMessage":"No handshaker response received","messagePattern":"No handshaker response received","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"alts/src/main/java/io/grpc/alts/internal/AltsHandshakerStub.java","lineNumber":77,"sourceCode":"\n  /** Send a handshaker request and return the handshaker response. */\n  public HandshakerResp send(HandshakerReq req) throws InterruptedException, IOException {\n    createWriterIfNull();\n    maybeThrowIoException();\n    if (!responseQueue.isEmpty()) {\n      throw new IOException(\"Received an unexpected response.\");\n    }\n\n    writer.onNext(req);\n    Optional<HandshakerResp> result = responseQueue.take();\n    if (result.isPresent()) {\n      return result.get();\n    }\n\n    if (exceptionMessage.get() != null) {\n      throw new IOException(exceptionMessage.get().info, exceptionMessage.get().throwable);\n    } else {\n      throw new IOException(\"No handshaker response received\");\n    }\n  }\n\n  /** Create a new writer if the writer is null. */\n  private void createWriterIfNull() {\n    if (writer == null) {\n      writer =\n          serviceStub.withDeadlineAfter(HANDSHAKE_RPC_DEADLINE_SECS, SECONDS).doHandshake(reader);\n    }\n  }\n\n  /** Throw exception if there is an outstanding exception. */\n  private void maybeThrowIoException() throws IOException {\n    if (exceptionMessage.get() != null) {\n      throw new IOException(exceptionMessage.get().info, exceptionMessage.get().throwable);\n    }\n  }\n","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/alts/src/main/java/io/grpc/alts/internal/AltsHandshakerStub.java#L59-L95","documentation":"AltsHandshakerStub.send() blocks on a response from the handshaker service. If the take() returns an empty Optional (stream closed / EOF) and no exception message was recorded, the handshake ended without any response, so send() throws IOException(\"No handshaker response received\").","triggerScenarios":"The handshaker stream closes (onClose/onError) before delivering a HandshakerResp — e.g. connection to the handshaker service dropped immediately, service crashed, or stream cancelled before any response arrived.","commonSituations":"Handshaker service unreachable and the connection torn down before a response; network interruption mid-handshake; handshaker service rejecting the request and closing the stream without a status response.","solutions":["Verify the ALTS handshaker service address is reachable (network/firewall/DNS) and the service is running","Retry the handshake — transient disconnects typically succeed on retry","Check handshaker service logs for why it closed the stream before responding","Catch IOException from send() and rebuild the stub before retrying, since the stream is closed"],"exampleFix":"// before\nHandshakerResp resp = stub.send(req); // IOException on abrupt stream close\n// after\ntry {\n  HandshakerResp resp = stub.send(req);\n} catch (IOException e) {\n  stub = createNewStub(handshakerAddr); // stream is dead; reconnect and retry\n  retryHandshake(stub);\n}","handlingStrategy":"retry","validationCode":"// before handshake: check reachability\nif (!isHandshakerServiceReachable(handshakerAddr)) {\n  throw new IOException(\"ALTS handshaker service unreachable: \" + handshakerAddr);\n}","typeGuard":"null","tryCatchPattern":"try {\n  HandshakerResp resp = stub.send(req);\n} catch (IOException e) {\n  stub = recreateStub();\n  retryWithBackoff();\n}","preventionTips":["Verify handshaker service address/firewall/DNS before handshaking","Monitor handshaker service health","Always recreate the stub after a closed stream"],"tags":["grpc","alts","handshake","network","empty-response"],"backgroundTag":"empty-response-body","analyzedSha":"64daddc1f3d1975670f769f3e97bde8b2ba32d25","analyzedAt":"2026-09-08T06:14:57.704Z","contentChangedAt":"2026-09-08T06:14:57.704Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}