{
  "id": "python/flask-cors-preflight-failed",
  "signature": "Access to fetch at 'http://localhost:5000/api' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.",
  "signature_zh": "访问 'http://localhost:5000/api' 被 CORS 策略阻止：请求的资源上没有 'Access-Control-Allow-Origin' 头。",
  "regex": "Access\\ to\\ fetch\\ at\\ 'http://localhost:5000/api'\\ from\\ origin\\ 'http://localhost:3000'\\ has\\ been\\ blocked\\ by\\ CORS\\ policy:\\ No\\ 'Access\\-Control\\-Allow\\-Origin'\\ header\\ is\\ present\\ on\\ the\\ requested\\ resource\\.",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "Flask-CORS not installed/registered, or OPTIONS preflight not handled because route restricts methods.",
  "root_cause_type": "generic",
  "root_cause_zh": "未安装/注册 Flask-CORS，或由于路由限制了方法导致 OPTIONS 预检请求未被处理。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Preflight OPTIONS still returns 405 before after_request runs.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "CORS is server-controlled; client cannot bypass it.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "from flask_cors import CORS; CORS(app, resources={r'/api/*': {'origins': 'http://localhost:3000'}})",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Ensure route methods include OPTIONS: @app.route('/api', methods=['GET','POST','OPTIONS'])",
      "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-04-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}