# ERR 用户 'myuser' 的 ACL 类别 'write' 和 'readonly' 不能组合

- **ID:** `redis/acl-category-inheritance-conflict`
- **领域:** redis
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 95%

## 根因

用户配置包含冲突的 ACL 类别权限；'write' 允许写入命令，而 'readonly' 限制为只读，导致无效状态。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Redis 7.0.0 | active | — | — |
| Redis 7.2.0 | active | — | — |
| Redis 7.4.0 | active | — | — |

## 解决方案

1. ```
   使用 ACL SETUSER myuser -readonly（或 -write）移除冲突的类别，确保只有一组权限处于活动状态。
   ```
2. ```
   使用单一类别重新创建用户：ACL SETUSER myuser on >password +@readonly ~* 授予只读访问权限，不包含写入权限。
   ```
3. ```
   审计 ACL 规则文件（例如 users.acl）并手动编辑以移除冲突行，然后使用 ACL LOAD 重新加载。
   ```

## 无效尝试

- **** — Adding more conflicting categories (e.g., both 'admin' and 'restricted') only exacerbates the conflict without resolving it. (90% 失败率)
- **** — Deleting the user and recreating with the same conflicting categories will reproduce the same error. (95% 失败率)
- **** — Ignoring the error and proceeding with other operations may leave the user in an inconsistent state, causing unpredictable behavior. (70% 失败率)
