{"record":{"id":"aad50f2da36d1b94","repo":"apache/pulsar","slug":"gettopicnotfounderrormessage-topicname-tostring","errorCode":null,"errorMessage":"getTopicNotFoundErrorMessage(topicName.toString())","messagePattern":"getTopicNotFoundErrorMessage\\(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":664,"sourceCode":"                .thenCompose(__ -> {\n                    if (topicName.isPartitioned()) {\n                        return getPropertiesAsync();\n                    }\n                    return pulsar().getBrokerService().fetchPartitionedTopicMetadataAsync(topicName)\n                            .thenCompose(metadata -> {\n                                if (metadata.partitions == 0) {\n                                    return getPropertiesAsync();\n                                }\n                                return CompletableFuture.completedFuture(metadata.properties);\n                            });\n                });\n    }\n\n    private CompletableFuture<Map<String, String>> getPropertiesAsync() {\n        return pulsar().getBrokerService().getTopicIfExists(topicName.toString())\n                .thenApply(opt -> {\n                    if (!opt.isPresent()) {\n                        throw new RestException(Status.NOT_FOUND,\n                                getTopicNotFoundErrorMessage(topicName.toString()));\n                    }\n                    return ((PersistentTopic) opt.get()).getManagedLedger().getProperties();\n        });\n    }\n\n    protected CompletableFuture<Void> internalUpdatePropertiesAsync(boolean authoritative,\n                                                                    Map<String, String> properties) {\n        if (properties == null || properties.isEmpty()) {\n            log.warn()\n                    .attr(\"topic\", topicName)\n                    .log(\"properties is empty, ignore update\");\n            return CompletableFuture.completedFuture(null);\n        }\n        return validateTopicOperationAsync(topicName, TopicOperation.UPDATE_METADATA)\n                .thenCompose(__ -> validateTopicOwnershipAsync(topicName, authoritative))\n                .thenCompose(__ -> {\n                    if (topicName.isPartitioned()) {","sourceCodeStart":646,"sourceCodeEnd":682,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L646-L682","documentation":"HTTP 404 thrown by getPropertiesAsync (used by the topic-properties admin API) when getTopicIfExists returns empty, i.e. no persistent topic is loaded/existing under the given name on this broker. The endpoint reads managed-ledger properties, which only exist for an actual PersistentTopic, so a missing topic yields NOT_FOUND with the standard 'topic not found' message.","triggerScenarios":"GET /admin/v2/persistent/{ns}/{topic}/properties on a topic that does not exist, was already deleted, or is only present as partitioned metadata without the individual partition loaded.","commonSituations":"Querying properties of a deleted topic; hitting a broker that does not own the topic without redirection (wrong service URL); typo in topic name; topic exists but partitions were never created.","solutions":["Verify the topic exists: `pulsar-admin topics list <namespace>` or `pulsar-admin topics stats`, create it if missing.","Ensure you query the exact partition name (e.g. topic-partition-0) for persistent topics, or the partitioned parent for its own properties.","Confirm your client targets the correct cluster/service URL so the lookup/redirect resolves to the owning broker.","Recreate the topic if it was deleted and properties are needed afterwards."],"exampleFix":"// before\nGET /admin/v2/persistent/my-tenant/my-ns/my-topic/properties\n// after (query an existing partition)\nGET /admin/v2/persistent/my-tenant/my-ns/my-topic-partition-0/properties","handlingStrategy":"try-catch","validationCode":"if (!admin.topics().getList(namespace).contains(topic)) {\n    throw new IllegalStateException(\"Topic \" + topic + \" does not exist\");\n}\nMap<String,String> props = admin.topics().getProperties(topic);","typeGuard":null,"tryCatchPattern":"try {\n    return admin.topics().getProperties(topic);\n} catch (PulsarAdminException.NotFoundException e) {\n    return Collections.emptyMap();\n}","preventionTips":["Check topic existence with getList or stats before reading properties","Use the correct partition name for persistent topics","Route requests to the owning broker/cluster"],"tags":["pulsar","rest-api","topic-not-found"],"backgroundTag":"topic-not-found","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"}