Kafka Error INVALID_REQUEST
Error code 42 · Non-retriable Admin
This most likely occurs because of a request being malformed by the client library or the message was sent to an incompatible broker. See the broker logs for more details.
Common Causes
- Client library version mismatch: client sends a request using fields or API versions incompatible with the broker (usually after partial upgrades)
- Corrupted or truncated request frame caused by a proxy, load balancer, or custom network layer between client and broker
- Application directly constructing raw Kafka protocol bytes with incorrect field sizes, magic bytes, or CRC values
Solutions
- Align client library version with the broker version; avoid mixing major client versions across services in the same cluster
- Remove any transparent proxies or middleware that may modify TCP streams between clients and brokers; use direct connections
- Enable broker-side TRACE logging temporarily (log4j kafka.request.logger=TRACE) to see the malformed request content
Diagnostic Commands
# Verify broker connectivity and API versions
kafka-broker-api-versions.sh --bootstrap-server localhost:9092 --command-config client.properties 2>&1 | head -10
# Look for invalid request errors in logs
grep 'INVALID_REQUEST\|InvalidRequestException\|Unexpected error' /var/log/kafka/server.log | tail -20Related APIs
This error can be returned by: AddOffsetsToTxn · AddPartitionsToTxn · ApiVersions · EndTxn · FindCoordinator · GetTelemetrySubscriptions · InitProducerId · ShareAcknowledge · ShareFetch · ShareGroupHeartbeat
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.