Kafka Error INVALID_REQUIRED_ACKS
Error code 21 · Non-retriable Producer
Produce request specified an invalid value for required acks.
Common Causes
- Producer 'acks' config set to a value other than 0, 1, or -1/all (e.g., '2', 'true', or 'ALL' with wrong case in some client libraries)
- Application code passing acks as an integer greater than 1 (e.g., acks=2 meaning 'wait for 2 replicas' — not valid; only -1/all is supported for multi-replica ack)
- Configuration file type coercion issue where acks=all gets parsed as a boolean or non-standard string by the client
Solutions
- Use only valid acks values: '0' (no ack), '1' (leader ack), or '-1'/'all' (full ISR ack); update producer config and validate at application startup
- Add config validation in CI: check that 'acks' property is one of the three allowed values before deploying; reject configs with acks=2 or any other integer
- In Java clients, prefer using the constant ProducerConfig.ACKS_CONFIG with value '"all"' (string) rather than integer literals to avoid type confusion
Diagnostic Commands
# Check producer acks configuration
grep -i 'acks\|required.acks' <producer-config-file>
# Describe topic-level configuration overrides
kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics --entity-name <topic> --describeRelated APIs
This error can be returned by: Produce · WriteTxnMarkers
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.