{"record":{"id":"0285d90a65d4841a","repo":"apache/pulsar","slug":"no-active-broker-is-available","errorCode":null,"errorMessage":"No active broker is available","messagePattern":"No active broker is available","errorType":"exception","errorClass":"PulsarServerException","httpStatus":null,"severity":"error","filePath":"pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/BrokerDiscoveryProvider.java","lineNumber":90,"sourceCode":"     * Used by Protocol Handlers\n     * @return the list of available brokers\n     * @throws PulsarServerException\n     */\n    public List<? extends ServiceLookupData> getAvailableBrokers() throws PulsarServerException {\n        return metadataStoreCacheLoader.getAvailableBrokers();\n    }\n\n    /**\n     * Find next broker {@link LoadManagerReport} in round-robin fashion.\n     *\n     * @return\n     * @throws PulsarServerException\n     */\n    LoadManagerReport nextBroker() throws PulsarServerException {\n        List<LoadManagerReport> availableBrokers = metadataStoreCacheLoader.getAvailableBrokers();\n\n        if (availableBrokers.isEmpty()) {\n            throw new PulsarServerException(\"No active broker is available\");\n        } else {\n            int brokersCount = availableBrokers.size();\n            int nextIdx = signSafeMod(counter.getAndIncrement(), brokersCount);\n            return availableBrokers.get(nextIdx);\n        }\n    }\n\n    @Override\n    public void close() throws IOException {\n        metadataStoreCacheLoader.close();\n        orderedExecutor.shutdown();\n        scheduledExecutorScheduler.shutdownNow();\n    }\n\n}\n","sourceCodeStart":72,"sourceCodeEnd":106,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/BrokerDiscoveryProvider.java#L72-L106","documentation":"nextBroker() fetches the cached list of active brokers from the metadata store; when that list is empty it cannot do round-robin selection and throws PulsarServerException('No active broker is available'). The proxy is running but no broker has registered itself in the load manager reports yet.","triggerScenarios":"Calling nextBroker() (discovery lookup path for proxy -> broker routing) while metadataStoreCacheLoader.getAvailableBrokers() returns an empty list — no broker load reports present in the metadata store cache.","commonSituations":"All brokers down or still starting; proxy pointed at the wrong ZooKeeper/metadata-store namespace so it sees no broker registrations; network partition between proxy and broker cluster; cache loader session timeout causing a temporarily empty view.","solutions":["Verify brokers are up and registered (check /loadbalance/brokers in ZooKeeper or the equivalent metadata path)","Confirm the proxy's metadataStoreUrl points to the same cluster as the brokers","Restart or scale up the broker cluster if all brokers are down","Retry the client operation once brokers register; the list is refreshed by the cache loader"],"exampleFix":"// before: proxy pointed at dev cluster metadata\ncluster1: metadataStoreUrl=zk:dev-zk:2181\n// after: point proxy at the production cluster hosting brokers\ncluster1: metadataStoreUrl=zk:prod-zk-1:2181,prod-zk-2:2181","handlingStrategy":"retry","validationCode":"// Before issuing discovery requests, check broker registrations exist\nList<LoadManagerReport> brokers = discoveryProvider.getAvailableBrokers();\nif (brokers == null || brokers.isEmpty()) {\n    throw new ServiceUnavailableException(\"No brokers registered yet; retry later\");\n}","typeGuard":null,"tryCatchPattern":"try { LoadManagerReport b = provider.nextBroker(); } catch (PulsarServerException e) {\n    if (\"No active broker is available\".equals(e.getMessage())) {\n        // exponential backoff retry; broker may still be registering\n    }\n}","preventionTips":["Ensure proxy and brokers point at the same metadata store/cluster","Delay client traffic until at least one broker is registered","Monitor broker registration count in /loadbalance"],"tags":["pulsar-proxy","discovery","brokers"],"backgroundTag":"no-active-broker-available","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}