t8y2/dbx · error · IllegalArgumentException

ZooKeeper did not return any usable Kafka broker endpoints

Error message

ZooKeeper did not return any usable Kafka broker endpoints

What it means

Thrown by brokerEndpoints during ZooKeeper-based discovery when broker registrations under /brokers/ids yielded no usable host:port endpoint for the configured security protocol — e.g. all listeners were filtered by protocol mismatch or registrations lacked connectable address fields. Discovery produces an empty endpoint set, so bootstrap server resolution fails.

Source

Thrown at agents/drivers/kafka/src/main/java/com/dbx/agent/kafka/KafkaAgent.java:445

                    : listener;
                if (!targetProtocol.equals(mappedProtocol)) continue;
                String address = endpointAddress(endpoint);
                if (address != null) addresses.add(address);
            }

            if (addresses.size() == addressCount && endpoints.size() == 0 && registration.has("host") && registration.has("port")) {
                try {
                    String host = registration.get("host").getAsString().trim();
                    int port = registration.get("port").getAsInt();
                    if (!host.isEmpty() && port > 0 && port <= 65535) addresses.add(formatHostPort(host, port));
                } catch (RuntimeException e) {
                    logger().warn("Skipping malformed legacy Kafka broker registration", e);
                }
            }
        }

        if (addresses.isEmpty()) {
            throw new IllegalArgumentException("ZooKeeper did not return any usable Kafka broker endpoints");
        }
        return String.join(",", addresses);
    }

    private static String endpointAddress(String endpoint) {
        try {
            URI uri = URI.create(endpoint);
            String host = uri.getHost();
            int port = uri.getPort();
            if (host == null || host.isBlank() || port <= 0 || port > 65535) return null;
            return formatHostPort(host, port);
        } catch (IllegalArgumentException e) {
            logger().debug("Skipping malformed Kafka broker endpoint", e);
            return null;
        }
    }

    private static String formatHostPort(String host, int port) {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Check that the Kafka brokers advertise listeners matching the agent's security_protocol setting (e.g. PLAINTEXT vs SSL)
  2. Inspect a broker registration in ZooKeeper (/brokers/ids/<id>) and confirm its listener endpoints contain valid host and port
  3. Ensure advertised.listeners on the brokers includes a listener reachable from the agent host
  4. Fall back to explicit bootstrap_servers configuration
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at agents/drivers/kafka/src/main/java/com/dbx/agent/kafka/KafkaAgent.java:445 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/cc9efd45418553c6. Report an issue: GitHub.