# TypeError: __call__() takes 1 positional argument but 2 were given

- **ID:** `python/starlette-middleware-error`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

中间件类未正确实现 __call__ 方法。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   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)
   ```
2. **** (85% success)
   ```
   async def simple_middleware(request, call_next):\n    response = await call_next(request)\n    return response
   ```

## Dead Ends

- **** — 签名不匹配。 (70% fail)
- **** — 导致中间件无法工作。 (90% fail)
