# org.apache.kafka.common.errors.TransactionalIdAuthorizationException: 事务ID授权失败

- **ID:** `kafka/transactional-id-authorization-failed`
- **领域:** kafka
- **类别:** auth_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

生产者的事务ID未被代理ACL授权对事务ID资源执行WRITE操作。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 2.8.0 | active | — | — |
| 3.2.0 | active | — | — |
| 3.4.0 | active | — | — |

## 解决方案

1. ```
   使用 kafka-acls.sh 为事务ID添加WRITE权限，授予生产者主体。
   ```
2. ```
   使用 kafka-acls.sh 在事务ID资源上授予DESCRIBE和WRITE权限。
   ```
3. ```
   如果使用Kafka 3.0+，启用 'authorizer.class.name' 为 'kafka.security.authorizer.AclAuthorizer'，并通过AdminClient API添加ACL。
   ```

## 无效尝试

- **** — Disabling ACLs globally bypasses security but introduces vulnerability; does not fix authorization logic. (95% 失败率)
- **** — Super users bypass ACLs but require broker restart; not a scalable solution for multiple producers. (80% 失败率)
- **** — New transactional ID still needs ACL authorization; error persists unless ACLs are updated. (90% 失败率)
