{
  "id": "python/django-missing-request-csrf-token",
  "signature": "django.core.exceptions.ImproperlyConfigured: CSRF cookie not set. Request failed.",
  "signature_zh": "django.core.exceptions.ImproperlyConfigured: 未设置CSRF cookie。请求失败。",
  "regex": "django\\.core\\.exceptions\\.ImproperlyConfigured:\\ CSRF\\ cookie\\ not\\ set\\.\\ Request\\ failed\\.",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The view is not using @csrf_exempt but the template lacks {% csrf_token %} in the form, causing CSRF middleware to reject the POST request.",
  "root_cause_type": "generic",
  "root_cause_zh": "视图未使用@csrf_exempt，但模板中的表单缺少{% csrf_token %}，导致CSRF中间件拒绝POST请求。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Disables security protection for all views, causing security vulnerabilities and potential 403 errors elsewhere.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Overrides CSRF protection globally, making the app vulnerable to CSRF attacks and breaking expected behavior.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Ensure the form in template includes {% csrf_token %} inside <form> tag.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "If using AJAX, include 'X-CSRFToken' header with token from cookie.",
      "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": "2024-03-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}