# java.io.IOException: Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.common.errors.TimeoutException)

- **ID:** `kafka/network-exception-read-returned-negative`
- **Domain:** kafka
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The Kafka client cannot establish a TCP connection to the broker, often due to network misconfiguration or broker downtime.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Kafka 2.8.0 | active | — | — |
| Kafka 3.0.0 | active | — | — |
| Kafka 3.4.0 | active | — | — |

## Workarounds

1. **Verify broker availability by running `telnet localhost 9092` or `nc -zv localhost 9092` to ensure the port is open. Then check broker logs for errors.** (85% success)
   ```
   Verify broker availability by running `telnet localhost 9092` or `nc -zv localhost 9092` to ensure the port is open. Then check broker logs for errors.
   ```
2. **Update `bootstrap.servers` in the producer/consumer configuration to point to a correct, reachable broker list (e.g., `bootstrap.servers=broker1:9092,broker2:9092`).** (90% success)
   ```
   Update `bootstrap.servers` in the producer/consumer configuration to point to a correct, reachable broker list (e.g., `bootstrap.servers=broker1:9092,broker2:9092`).
   ```

## Dead Ends

- **Restarting the Kafka client without checking broker health** — The underlying broker issue (e.g., crash, network partition) remains unresolved, so the error recurs. (90% fail)
- **Increasing `request.timeout.ms` to a very high value** — A timeout extension does not fix the connection failure; it only delays the error message. (70% fail)
