{
  "id": "python/django-model-save-error",
  "signature": "django.db.utils.IntegrityError: NOT NULL constraint failed: app_model.field",
  "signature_zh": "Django数据库完整性错误：NOT NULL约束失败：app_model.field",
  "regex": "django\\.db\\.utils\\.IntegrityError:\\ NOT\\ NULL\\ constraint\\ failed:\\ app_model\\.field",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Attempting to save a model instance with a required field set to NULL.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试保存模型实例时，必填字段设置为NULL。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Setting field to empty string",
      "why_fails": "Empty string is not NULL but may still violate constraints if blank=False.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Ignoring the field",
      "why_fails": "Field must have a value.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Provide a default value or set the field before save",
      "success_rate": 0.95,
      "how": "instance.field = value; instance.save()",
      "condition": "",
      "sources": []
    },
    {
      "action": "Allow NULL in model definition",
      "success_rate": 0.9,
      "how": "field = models.CharField(null=True, blank=True)",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}