{
  "id": "go/concurrent-map-write-fatal",
  "signature": "fatal error: concurrent map writes",
  "signature_zh": "致命错误：并发写入 map",
  "regex": "fatal\\ error:\\ concurrent\\ map\\ writes",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Multiple goroutines write to the same Go map without synchronization. Go's runtime detects the concurrent write and aborts the program; this is not recoverable via recover().",
  "root_cause_type": "generic",
  "root_cause_zh": "多个 goroutine 在无同步的情况下写入同一个 Go map。Go 运行时检测到并发写入后直接终止程序，无法通过 recover() 恢复。",
  "versions": [
    {
      "version": "1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "fatal error is thrown by the runtime and bypasses the normal panic/recover mechanism entirely",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Partial locking still leaves a write racing a read; the runtime still aborts",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "var mu sync.RWMutex; mu.Lock(); m[k]=v; mu.Unlock() — guard every access (read and write) with the same mutex",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use sync.Map for read-mostly or disjoint-key workloads: var m sync.Map; m.Store(k, v); m.Load(k)",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-11",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}