# AssertionError: 'allow_origins' must be a list or tuple

- **ID:** `python/fastapi-cors-middleware-config`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

CORS 中间件的 allow_origins 参数类型错误，例如传入了字符串。

## Version Compatibility

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

## Workarounds

1. **** (100% success)
   ```
   app.add_middleware(CORSMiddleware, allow_origins=['*'], allow_methods=['*'])
# 或 allow_origins=["http://localhost:3000"]
   ```

## Dead Ends

- **** — 仍然是一个字符串，不是列表 (80% fail)
- **** — 可能过于宽松，导致安全问题 (50% fail)
