{
  "id": "python/fastapi-openapi-schema-generation-error",
  "signature": "fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that typing.Union[str, NoneType] is a valid Pydantic field type.",
  "signature_zh": "fastapi.exceptions.FastAPIError: 响应字段参数无效！提示：检查 typing.Union[str, NoneType] 是否为有效的 Pydantic 字段类型。",
  "regex": "fastapi\\.exceptions\\.FastAPIError:\\ Invalid\\ args\\ for\\ response\\ field!\\ Hint:\\ check\\ that\\ typing\\.Union\\[str,\\ NoneType\\]\\ is\\ a\\ valid\\ Pydantic\\ field\\ type\\.",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "A return annotation used a construct FastAPI cannot convert to a Pydantic field (e.g., a custom class without validation, or an unsupported generic).",
  "root_cause_type": "generic",
  "root_cause_zh": "返回注解使用了 FastAPI 无法转换为 Pydantic 字段的结构（如无校验的自定义类或不受支持的泛型）。",
  "versions": [
    {
      "version": "0.100+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Loses schema and docs; underlying type issue remains.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Bypasses OpenAPI generation but not validation.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "class Out(BaseModel):\n    name: str\n@app.get('/x', response_model=Out)\ndef x(): ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "from typing import Any\n@app.get('/x')\ndef x() -> Any: ...",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}