{
  "id": "go/grpc-already-exists-duplicate-resource",
  "signature": "rpc error: code = AlreadyExists desc = user with email 'a@b.com' already exists",
  "signature_zh": "rpc error: code = AlreadyExists desc = 邮箱为 'a@b.com' 的用户已存在",
  "regex": "rpc\\ error:\\ code\\ =\\ AlreadyExists\\ desc\\ =\\ user\\ with\\ email\\ 'a@b\\.com'\\ already\\ exists",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The server rejected a create because a unique constraint (email, ID, etc.) was violated. Often caused by retries without idempotency keys.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务端因唯一约束（邮箱、ID 等）被违反而拒绝创建。通常由不带幂等键的重试引起。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The existing resource may differ from the intended one; silently accepting hides data bugs",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Creates duplicate logical entities and violates business rules",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "md := metadata.Pairs(\"idempotency-key\", uuid.NewString())\nctx := metadata.NewOutgoingContext(ctx, md)\n_, err := client.CreateUser(ctx, req)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "if status.Code(err) == codes.AlreadyExists {\n  existing, _ := client.GetUser(ctx, &pb.GetUserReq{Email: req.Email})\n  return existing, nil\n}",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-02-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}