{
  "id": "go/grpc-aborted-streaming-write",
  "signature": "rpc error: code = Aborted desc = SendMsg called after CloseSend",
  "signature_zh": "rpc error: code = Aborted desc = 在 CloseSend 之后调用了 SendMsg",
  "regex": "rpc\\ error:\\ code\\ =\\ Aborted\\ desc\\ =\\ SendMsg\\ called\\ after\\ CloseSend",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Client streaming code calls stream.Send after stream.CloseSend() or after the server already sent a terminal status, violating the client-stream state machine.",
  "root_cause_type": "generic",
  "root_cause_zh": "客户端流式代码在 stream.CloseSend() 之后或服务端已发送终止状态后调用 stream.Send，违反了客户端流状态机。",
  "versions": [
    {
      "version": "1.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Stream is already closed; subsequent sends keep returning Aborted.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Streams are single-use; a new client.Upload(ctx) call is required.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "for _, item := range items {\n  if err := stream.Send(item); err != nil {\n    return fmt.Errorf(\"send: %w\", err)\n  }\n}\nif err := stream.CloseSend(); err != nil { return err }\nresp, err := stream.CloseAndRecv()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "if err := stream.Context().Err(); err != nil {\n  return err\n}\nstream.Send(item)",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-04-14",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}