# Django数据库完整性错误：唯一约束失败：auth_user.email

- **ID:** `python/django-auth-user-email-unique`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

尝试创建具有已存在电子邮件的用户。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   Check email existence before creation: if User.objects.filter(email=email).exists(): return error
   ```

## 无效尝试

- **** — User is not created, no feedback to user. (60% 失败率)
- **** — Allows duplicate emails, breaking user identification. (70% 失败率)
