apache/pulsar · error · ServiceUnitNotReadyException

Topic creation encountered an exception by initialize topic

Error message

Topic creation encountered an exception by initialize topic policies service. topic_name=${topicName} error_message=${rc.getMessage()}

What it means

Topic creation failed during initialization of the topic-level policy service (e.g. creating the system-topic policy cursor); the underlying error message is attached and the topic-load future completes exceptionally, leaving the topic uncreated.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:2627

            managedLedgerConfig.setTriggerOffloadOnTopicLoad(serviceConfig.isTriggerOffloadOnTopicLoad());

            managedLedgerConfig.setDeletionAtBatchIndexLevelEnabled(
                    serviceConfig.isAcknowledgmentAtBatchIndexLevelEnabled());
            managedLedgerConfig.setNewEntriesCheckDelayInMillis(
                    serviceConfig.getManagedLedgerNewEntriesCheckDelayInMillis());
            return managedLedgerConfig;
        }).exceptionally(ex -> {
            final Throwable rc = FutureUtil.unwrapCompletionException(ex);
            log.error().attr("topic", topicName)
                    .exceptionMessage(rc)
                    .log("Topic creation encountered an exception"
                            + " by initialize topic policies service");
            final String errorInfo = String.format(
                    "Topic creation encountered an exception by initialize"
                            + " topic policies service. topic_name=%s"
                            + " error_message=%s",
                    topicName, rc.getMessage());
            throw FutureUtil.wrapToCompletionException(
                    new ServiceUnitNotReadyException(errorInfo));
        });
    }

    private void addTopicToStatsMaps(TopicName topicName, Topic topic) {
        pulsar.getNamespaceService().getBundleAsync(topicName)
                .thenAccept(namespaceBundle -> {
                    if (namespaceBundle != null) {
                        synchronized (multiLayerTopicsMap) {
                            String serviceUnit = namespaceBundle.toString();
                            multiLayerTopicsMap.computeIfAbsent(topicName.getNamespace(),
                                    __ -> new ConcurrentHashMap<>()
                            ).computeIfAbsent(serviceUnit, __ -> new ConcurrentHashMap<>()
                            ).put(topicName.toString(), topic);
                        }
                    }
                    invalidateOfflineTopicStatCache(topicName);
                })

View on GitHub (pinned to 820761864e)

Solutions

  1. Inspect the error_message cause in the broker log (often system-topic or metadata-store failure)
  2. Verify the topic-level policies system topic is healthy and retry loading the topic
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:2627 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/e36f52124704dd50. Report an issue: GitHub.