{"record":{"id":"1f9617356aa639e8","repo":"grpc/grpc-java","slug":"n-not-found-hex","errorCode":null,"errorMessage":"\\n not found: ${hex}","messagePattern":"\\\\n not found: (.+?)","errorType":"exception","errorClass":"EOFException","httpStatus":null,"severity":"error","filePath":"okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java","lineNumber":936,"sourceCode":"        .build();\n\n    Request.Builder request = new Request.Builder()\n        .url(tunnelUrl)\n        .header(\"Host\", tunnelUrl.host() + \":\" + tunnelUrl.port())\n        .header(\"User-Agent\", userAgent);\n\n    // If we have proxy credentials, set them right away\n    if (proxyUsername != null && proxyPassword != null) {\n      request.header(\"Proxy-Authorization\", Credentials.basic(proxyUsername, proxyPassword));\n    }\n    return request.build();\n  }\n\n  private static String readUtf8LineStrictUnbuffered(Source source) throws IOException {\n    Buffer buffer = new Buffer();\n    while (true) {\n      if (source.read(buffer, 1) == -1) {\n        throw new EOFException(\"\\\\n not found: \" + buffer.readByteString().hex());\n      }\n      if (buffer.getByte(buffer.size() - 1) == '\\n') {\n        return buffer.readUtf8LineStrict();\n      }\n    }\n  }\n\n  @Override\n  public String toString() {\n    return MoreObjects.toStringHelper(this)\n        .add(\"logId\", logId.getId())\n        .add(\"address\", address)\n        .toString();\n  }\n\n  @Override\n  public InternalLogId getLogId() {\n    return logId;","sourceCodeStart":918,"sourceCodeEnd":954,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java#L918-L954","documentation":"readUtf8LineStrictUnbuffered throws EOFException when the HTTP/1.x proxy handshake response stream ends before a newline is found. The hex is the partial bytes read. It means the CONNECT response (or header line) was truncated — the peer closed the connection mid-response.","triggerScenarios":"Running through an HTTP proxy whose CONNECT response is cut off by the proxy or an intermediary; connection reset during handshake; proxy returning an empty or partial response body.","commonSituations":"Misconfigured corporate proxies, proxies that drop long-lived connections, transparent proxies/firewalls interfering with CONNECT, unstable networks cutting the socket early.","solutions":["Fix or bypass the proxy (check https_proxy/HTTP_PROXY settings, proxy exclusions)","Test connectivity directly without the proxy to confirm the proxy is truncating responses","Retry the RPC; gRPC will re-establish the connection","If the proxy is required, upgrade/fix it so it returns a complete CONNECT response with CRLF"],"exampleFix":"// before\nOkHttpChannelBuilder.forAddress(host, port).proxyDetector(ProxyDetector.DEFAULT)... // bad proxy\n// after\nOkHttpChannelBuilder.forAddress(host, port) // bypass broken proxy\n  .proxyDetector(targetSocketAddress -> ProxyHelper.noProxy())\n  .build();","handlingStrategy":"retry","validationCode":"// pre-check proxy reachability\nSocket s = new Socket(); try { s.connect(proxyAddr, 5000); } finally { s.close(); }","typeGuard":null,"tryCatchPattern":"try { stub.unaryCall(req); } catch (StatusRuntimeException e) { if (e.getStatus().getCode() == Status.Code.UNAVAILABLE) { retryWithBackoff(); } throw e; }","preventionTips":["Audit proxy env vars and proxyDetector settings","Exclude gRPC traffic from intercepting proxies where possible","Enable keepalives and retries in channel config"],"tags":["grpc","okhttp","proxy","eof","http-connect"],"backgroundTag":"unexpected-response-shape","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"}