{
  "id": "python/fastapi-cors-credentials-error",
  "signature": "RuntimeError: CORS: Cannot use allow_credentials with allow_origins='*'",
  "signature_zh": "运行时错误：CORS：不能将allow_credentials与allow_origins='*'一起使用",
  "regex": "RuntimeError:\\ CORS:\\ Cannot\\ use\\ allow_credentials\\ with\\ allow_origins='\\*'",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "FastAPI CORS configuration uses allow_credentials=True with allow_origins=['*'], which is not allowed by the CORS specification.",
  "root_cause_type": "generic",
  "root_cause_zh": "FastAPI CORS配置使用了allow_credentials=True和allow_origins=['*']，CORS规范不允许这样做。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Setting allow_credentials to False without changing origins",
      "why_fails": "May break functionality that requires credentials.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Ignoring the error and deploying anyway",
      "why_fails": "CORS errors will occur in the browser.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Specify explicit origins instead of wildcard",
      "success_rate": 0.95,
      "how": "app.add_middleware(\n    CORSMiddleware,\n    allow_origins=[\"https://example.com\"],\n    allow_credentials=True,\n)",
      "condition": "",
      "sources": []
    },
    {
      "action": "Remove allow_credentials if wildcard is needed",
      "success_rate": 0.85,
      "how": "app.add_middleware(\n    CORSMiddleware,\n    allow_origins=[\"*\"],\n    allow_credentials=False,\n)",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}