{"record":{"id":"72b8c2df6ad155b6","repo":"apache/pulsar","slug":"partitioned-topic-not-found-s-s","errorCode":null,"errorMessage":"Partitioned Topic not found: %s %s","messagePattern":"Partitioned Topic not found: (.+?) (.+?)","errorType":"http","errorClass":"RestException","httpStatus":404,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java","lineNumber":4711,"sourceCode":"        return pulsar().getBrokerService().getTopicIfExists(topicName.toString())\n                .thenCompose(optTopic -> optTopic\n                        .map(CompletableFuture::completedFuture)\n                        .orElseGet(() -> topicNotFoundReasonAsync(topicName)));\n    }\n\n    private CompletableFuture<Topic> topicNotFoundReasonAsync(TopicName topicName) {\n        if (!topicName.isPartitioned()) {\n            return FutureUtil.failedFuture(new RestException(Status.NOT_FOUND,\n                    getTopicNotFoundErrorMessage(topicName.toString())));\n        }\n\n        return getPartitionedTopicMetadataAsync(\n                TopicName.get(topicName.getPartitionedTopicName()), false, false)\n                .thenAccept(partitionedTopicMetadata -> {\n                    if (partitionedTopicMetadata == null || partitionedTopicMetadata.partitions == 0) {\n                        final String topicErrorType = partitionedTopicMetadata\n                                == null ? \"has no metadata\" : \"has zero partitions\";\n                        throw new RestException(Status.NOT_FOUND, String.format(\n                                \"Partitioned Topic not found: %s %s\", topicName.toString(), topicErrorType));\n                    }\n                })\n                .thenCompose(__ -> internalGetListAsync(Optional.empty(), null))\n                .thenApply(topics -> {\n                    if (!topics.contains(topicName.toString())) {\n                        throw new RestException(Status.NOT_FOUND, \"Topic partitions were not yet created\");\n                    }\n                    throw new RestException(Status.NOT_FOUND,\n                        getPartitionedTopicNotFoundErrorMessage(topicName.toString()));\n            });\n    }\n\n    /**\n     * Find the subscription or create it when automatic subscription creation is allowed.\n     */\n    private CompletableFuture<Subscription> findOrCreateSubscriptionAsync(String subName, PersistentTopic topic) {\n        Subscription subscription = topic.getSubscription(subName);","sourceCodeStart":4693,"sourceCodeEnd":4729,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L4693-L4729","documentation":"topicNotFoundReasonAsync: the requested partitioned topic has no metadata in the metadata store (or zero partitions), so the partitioned topic does not exist; reported as NOT_FOUND with the formatted topic/type pair.","triggerScenarios":"Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:4711 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the partitioned topic with a positive partition count","Check the topic name spelling and namespace"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}