{
  "id": "python/fastapi-query-param-missing-annotation",
  "signature": "fastapi.exceptions.FastAPIError: Invalid args for response field 'items'",
  "signature_zh": "FastAPI错误：响应字段参数无效",
  "regex": "fastapi\\.exceptions\\.FastAPIError:\\ Invalid\\ args\\ for\\ response\\ field\\ 'items'",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Defining a response model with a field that has no type annotation or an invalid one (e.g., `items = []` without `List[Item]`) causes FastAPI to fail when generating the response schema.",
  "root_cause_type": "generic",
  "root_cause_zh": "在响应模型中定义没有类型注解或无效注解的字段（如`items = []`未指定`List[Item]`），FastAPI在生成响应模式时会失败。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Adding a default value like `items: list = []` still fails if the list type is not specified; FastAPI needs `List[SomeModel]`.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using `items: Any` works but loses validation and may not be what you want.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Define the response model with proper type hints: `from typing import List; class ResponseModel(BaseModel): items: List[Item]`",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use `response_model=List[Item]` in the route decorator instead of a custom model.",
      "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-03-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}