{
  "id": "go/grpc-internal-stream-terminated",
  "signature": "rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR",
  "signature_zh": "rpc error: code = Internal desc = 流被 RST_STREAM 终止，错误码：PROTOCOL_ERROR",
  "regex": "rpc\\ error:\\ code\\ =\\ Internal\\ desc\\ =\\ stream\\ terminated\\ by\\ RST_STREAM\\ with\\ error\\ code:\\ PROTOCOL_ERROR",
  "domain": "go",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "HTTP/2 stream reset by the peer, often caused by server-side panic in a handler, exceeding flow control, or a proxy (Envoy/nginx) resetting the connection.",
  "root_cause_type": "generic",
  "root_cause_zh": "HTTP/2 流被对端重置，通常由服务端处理器中的 panic、超出流控限制，或代理（Envoy/nginx）重置连接引起。",
  "versions": [
    {
      "version": "1.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If a handler panics deterministically, every stream resets.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "gRPC requires HTTP/2; disabling it breaks all calls.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.88,
      "how": "func recoverInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, h grpc.UnaryHandler) (any, error) {\n  defer func() { if r := recover(); r != nil { log.Printf(\"panic: %v\", r) } }()\n  return h(ctx, req)\n}\ns := grpc.NewServer(grpc.UnaryInterceptor(recoverInterceptor))",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.7,
      "how": "// Envoy example: set stream_idle_timeout: 0s or raise it in HttpConnectionManager config",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2024-08-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}