{
  "id": "python/fastapi-cors-middleware-misconfiguration",
  "signature": "AssertionError: allow_origins must be a list or tuple of strings",
  "signature_zh": "AssertionError: allow_origins 必须是字符串的列表或元组",
  "regex": "AssertionError:\\ allow_origins\\ must\\ be\\ a\\ list\\ or\\ tuple\\ of\\ strings",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The CORS middleware expects allow_origins as a list, but a string or other type is provided.",
  "root_cause_type": "generic",
  "root_cause_zh": "CORS 中间件期望 allow_origins 为列表，但提供了字符串或其他类型。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Starlette's CORSMiddleware requires a list, even for wildcard.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The assertion checks each element is a string, so non-strings cause failure.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 1.0,
      "how": "Use a list: allow_origins=[\"*\"] or allow_origins=[\"https://example.com\"]",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Use allow_origin_regex for pattern matching: allow_origin_regex=\"https?://.*\"",
      "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": "2024-04-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}