{
  "id": "python/fastapi-cors-middleware-origin",
  "signature": "AssertionError: 'allow_origins' must be a list of strings or a single string",
  "signature_zh": "断言错误：'allow_origins' 必须是字符串列表或单个字符串",
  "regex": "AssertionError:\\ 'allow_origins'\\ must\\ be\\ a\\ list\\ of\\ strings\\ or\\ a\\ single\\ string",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Passing an invalid type to CORSMiddleware allow_origins, such as a set or tuple.",
  "root_cause_type": "generic",
  "root_cause_zh": "向 CORSMiddleware 的 allow_origins 传递了无效类型，如集合或元组。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "FastAPI expects a list; set is not accepted.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "It's allowed but may cause issues with credentials; the assertion is for non-string types.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 1.0,
      "how": "Use a list: allow_origins=['*'] or allow_origins=['http://example.com']",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "If you need dynamic origins, use a function that returns a list",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-01-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}