{
  "id": "go/grpc-aborted-transaction-rollback",
  "signature": "rpc error: code = Aborted desc = transaction aborted: concurrent modification detected",
  "signature_zh": "rpc错误：代码=中止 描述=事务已中止：检测到并发修改",
  "regex": "rpc\\ error:\\ code\\ =\\ Aborted\\ desc\\ =\\ transaction\\ aborted:\\ concurrent\\ modification\\ detected",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A transaction was aborted due to a conflict with another concurrent transaction, common in distributed databases.",
  "root_cause_type": "generic",
  "root_cause_zh": "事务因与另一个并发事务冲突而中止，常见于分布式数据库。",
  "versions": [
    {
      "version": "1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Ignore the error and assume partial success.",
      "why_fails": "The transaction was fully aborted; no changes were applied.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "Immediately retry without any delay.",
      "why_fails": "Immediate retry may hit the same conflict again, especially under high contention.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Retry the transaction with exponential backoff and jitter.",
      "success_rate": 0.85,
      "how": "for i := 0; i < 5; i++ {\n    err := client.Transaction(ctx, req)\n    if err == nil { return nil }\n    if status.Code(err) != codes.Aborted { return err }\n    time.Sleep(time.Duration(100*(1<<i)) * time.Millisecond)\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "Reduce contention by using smaller transactions or optimistic locking.",
      "success_rate": 0.75,
      "how": "Design the system to minimize overlapping transactions, e.g., partition data by user ID.",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}