{"record":{"id":"cc9efd45418553c6","repo":"t8y2/dbx","slug":"zookeeper-did-not-return-any-usable-kafka-broker-e","errorCode":null,"errorMessage":"ZooKeeper did not return any usable Kafka broker endpoints","messagePattern":"ZooKeeper did not return any usable Kafka broker endpoints","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agents/drivers/kafka/src/main/java/com/dbx/agent/kafka/KafkaAgent.java","lineNumber":445,"sourceCode":"                    : listener;\n                if (!targetProtocol.equals(mappedProtocol)) continue;\n                String address = endpointAddress(endpoint);\n                if (address != null) addresses.add(address);\n            }\n\n            if (addresses.size() == addressCount && endpoints.size() == 0 && registration.has(\"host\") && registration.has(\"port\")) {\n                try {\n                    String host = registration.get(\"host\").getAsString().trim();\n                    int port = registration.get(\"port\").getAsInt();\n                    if (!host.isEmpty() && port > 0 && port <= 65535) addresses.add(formatHostPort(host, port));\n                } catch (RuntimeException e) {\n                    logger().warn(\"Skipping malformed legacy Kafka broker registration\", e);\n                }\n            }\n        }\n\n        if (addresses.isEmpty()) {\n            throw new IllegalArgumentException(\"ZooKeeper did not return any usable Kafka broker endpoints\");\n        }\n        return String.join(\",\", addresses);\n    }\n\n    private static String endpointAddress(String endpoint) {\n        try {\n            URI uri = URI.create(endpoint);\n            String host = uri.getHost();\n            int port = uri.getPort();\n            if (host == null || host.isBlank() || port <= 0 || port > 65535) return null;\n            return formatHostPort(host, port);\n        } catch (IllegalArgumentException e) {\n            logger().debug(\"Skipping malformed Kafka broker endpoint\", e);\n            return null;\n        }\n    }\n\n    private static String formatHostPort(String host, int port) {","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/kafka/src/main/java/com/dbx/agent/kafka/KafkaAgent.java#L427-L463","documentation":"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.","triggerScenarios":"Thrown at agents/drivers/kafka/src/main/java/com/dbx/agent/kafka/KafkaAgent.java:445 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the Kafka brokers advertise listeners matching the agent's security_protocol setting (e.g. PLAINTEXT vs SSL)","Inspect a broker registration in ZooKeeper (/brokers/ids/<id>) and confirm its listener endpoints contain valid host and port","Ensure advertised.listeners on the brokers includes a listener reachable from the agent host","Fall back to explicit bootstrap_servers configuration"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}