{"record":{"id":"46e2872166b36d0b","repo":"apache/pulsar","slug":"getpartitionedtopicnotfounderrormessage-topicname","errorCode":null,"errorMessage":"getPartitionedTopicNotFoundErrorMessage(topicName.toString())","messagePattern":"getPartitionedTopicNotFoundErrorMessage\\(topicName\\.toString\\(\\)\\)","errorType":"http","errorClass":"RestException","httpStatus":404,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java","lineNumber":4720,"sourceCode":"                    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);\n        if (subscription != null) {\n            return CompletableFuture.completedFuture(subscription);\n        }\n\n        return pulsar().getBrokerService().isAllowAutoSubscriptionCreationAsync(topicName)\n                .thenCompose(isAllowed -> {\n                    Subscription existingSubscription = topic.getSubscription(subName);\n                    if (existingSubscription != null) {\n                        return CompletableFuture.completedFuture(existingSubscription);","sourceCodeStart":4702,"sourceCodeEnd":4738,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L4702-L4738","documentation":"Helper that formats the NOT_FOUND message for a missing partitioned topic in topicNotFoundReasonAsync; it delegates to getPartitionedTopicNotFoundErrorMessage and is not itself an independent error cause.","triggerScenarios":"Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:4720 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat as 'partitioned topic not found': create the topic or fix its name","Verify partitioned topic metadata exists in the metadata store"],"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-14T00:17:10.932Z"}