# org.apache.kafka.common.errors.InvalidRequiredAcksException：必需的 acks 值无效。

- **ID:** `kafka/invalid-required-acks`
- **领域:** kafka
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

生产者发送了具有无效 'acks' 值（例如 -2 或 3）的请求，该值不在允许的 -1、0 或 1 集合中。

## 解决方案

1. ```
   Set acks to a valid value in the producer properties: `props.put('acks', 'all')` (equivalent to -1) or `props.put('acks', '1')`. Example fix: change `acks=-2` to `acks=1`.
   ```

## 无效尝试

- **** — Setting acks to 'all' (string) instead of -1 (integer) in the producer config causes a different error; this error specifically catches invalid integer values. (80% 失败率)
- **** — Ignoring the error and retrying with the same value will fail repeatedly; the config must be corrected. (100% 失败率)
