{
  "id": "python/fastapi-cors-preflight-400",
  "signature": "HTTP/1.1 400 Bad Request\nCORS preflight request failed: missing Access-Control-Request-Method",
  "signature_zh": "HTTP 400：CORS 预检请求失败，缺少 Access-Control-Request-Method。",
  "regex": "HTTP/1\\.1\\ 400\\ Bad\\ Request\\\nCORS\\ preflight\\ request\\ failed:\\ missing\\ Access\\-Control\\-Request\\-Method",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "CORSMiddleware not added, or added after other middleware that short-circuits OPTIONS; or allow_methods excludes the method.",
  "root_cause_type": "generic",
  "root_cause_zh": "未添加 CORSMiddleware，或在会短路 OPTIONS 的中间件之后添加；或 allow_methods 未包含该方法。",
  "versions": [
    {
      "version": "0.100.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "0.110.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Tedious and misses middleware ordering; CORSMiddleware already handles preflight.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Browsers reject wildcard with credentials.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "app.add_middleware(CORSMiddleware, allow_origins=['https://app.example.com'], allow_methods=['GET','POST','PUT','DELETE','OPTIONS'], allow_headers=['*'], allow_credentials=True) — add FIRST before other middlewares.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Verify order: middleware added later wraps earlier ones; CORS should be outermost.",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-09-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}