{
  "id": "python/starlette-middleware-error",
  "signature": "TypeError: __call__() takes 1 positional argument but 2 were given",
  "signature_zh": "类型错误：__call__() 接受 1 个位置参数，但给出了 2 个",
  "regex": "TypeError:\\ __call__\\(\\)\\ takes\\ 1\\ positional\\ argument\\ but\\ 2\\ were\\ given",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "中间件类未正确实现 __call__ 方法。",
  "root_cause_type": "generic",
  "root_cause_zh": "中间件类未正确实现 __call__ 方法。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "签名不匹配。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "导致中间件无法工作。",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "class MyMiddleware:\\n    def __init__(self, app):\\n        self.app = app\\n    async def __call__(self, scope, receive, send):\\n        await self.app(scope, receive, send)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "async def simple_middleware(request, call_next):\\n    response = await call_next(request)\\n    return response",
      "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": "2025-09-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}