{
  "id": "python/numpy-array-not-writeable",
  "signature": "ValueError: assignment destination is read-only",
  "signature_zh": "ValueError：赋值目标是只读的",
  "regex": "ValueError:\\ assignment\\ destination\\ is\\ read\\-only",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Array is read-only (e.g., from np.broadcast_to or a view backed by immutable buffer).",
  "root_cause_type": "generic",
  "root_cause_zh": "数组为只读（例如来自 np.broadcast_to 或不可变缓冲区视图）。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Still read-only; same error",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "May raise if buffer is genuinely immutable",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "arr = np.array(arr, copy=True) before mutation",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "arr.setflags(write=True) when array is a writable view",
      "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-01-14",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}