{"record":{"id":"36436231a72633ef","repo":"apache/pulsar","slug":"topic-s-does-not-exist","errorCode":null,"errorMessage":"Topic %s does not exist","messagePattern":"Topic (.+?) does not exist","errorType":"http","errorClass":"RestException","httpStatus":404,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java","lineNumber":581,"sourceCode":"        });\n    }\n\n    protected void internalCreateMissedPartitions(AsyncResponse asyncResponse) {\n        getPartitionedTopicMetadataAsync(topicName, false, false).thenAccept(metadata -> {\n            if (metadata != null && metadata.partitions > 0) {\n                validateNamespaceOperationAsync(topicName.getNamespaceObject(),\n                        NamespaceOperation.CREATE_TOPIC)\n                .thenCompose(__ -> tryCreatePartitionsAsync(metadata.partitions)).thenAccept(v -> {\n                    asyncResponse.resume(Response.noContent().build());\n                }).exceptionally(e -> {\n                    log.error()\n                            .attr(\"topic\", topicName)\n                            .log(\"Failed to create partitions for topic\");\n                    resumeAsyncResponseExceptionally(asyncResponse, e);\n                    return null;\n                });\n            } else {\n                throw new RestException(Status.NOT_FOUND, String.format(\"Topic %s does not exist\", topicName));\n            }\n        }).exceptionally(ex -> {\n            // If the exception is not redirect exception we need to log it.\n            if (!isRedirectException(ex)) {\n                log.error()\n                        .attr(\"topic\", topicName)\n                        .log(\"Failed to create partitions for topic\");\n            }\n            resumeAsyncResponseExceptionally(asyncResponse, ex);\n            return null;\n        });\n    }\n\n    protected CompletableFuture<Void> internalSetDelayedDeliveryPolicies(DelayedDeliveryPolicies deliveryPolicies,\n                                                                         boolean isGlobal) {\n        return pulsar().getTopicPoliciesService()\n                .updateTopicPoliciesAsync(topicName, isGlobal, deliveryPolicies == null, policies -> {\n                    policies.setDelayedDeliveryEnabled(deliveryPolicies == null ? null : deliveryPolicies.isActive());","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L563-L599","documentation":"HTTP 404 raised by internalCreateMissedPartitions when the partitioned topic metadata lookup reports no partitioned topic (metadata null or partitions <= 0). The create-missed-partitions admin endpoint only recreates missing individual partitions for an existing partitioned topic; if the partitioned parent topic does not exist in metadata, there is nothing to repair and the broker returns NOT_FOUND.","triggerScenarios":"POST /admin/v2/persistent/{ns}/{topic}/createMissedPartitions (or `pulsar-admin topics create-missed-partitions`) on a topic that was never created as a partitioned topic, or whose partitioned metadata was deleted.","commonSituations":"Typo in the topic name (partitioned topic actually named differently); calling create-missed-partitions before ever running create-partitioned-topic; partitioned metadata deleted after partitions were removed; pointing at the wrong tenant/namespace.","solutions":["First create the partitioned topic: `pulsar-admin topics create-partitioned-topic <topic> -p <n>`, then retry create-missed-partitions.","Verify the exact topic name/tenant/namespace with `pulsar-admin topics list-partitioned-topics <namespace>`.","If metadata should exist, inspect ZooKeeper/metadata store path for the partitioned topic and check broker logs for metadata lookup failures.","Use the non-partitioned topic name without the `-partition-` suffix — the endpoint expects the partitioned parent name."],"exampleFix":"// before\npulsar-admin topics create-missed-partitions persistent://my-tenant/my-ns/my-topic\n// after (create the partitioned topic first)\npulsar-admin topics create-partitioned-topic persistent://my-tenant/my-ns/my-topic -p 4\npulsar-admin topics create-missed-partitions persistent://my-tenant/my-ns/my-topic","handlingStrategy":"validation","validationCode":"PartitionedTopicMetadata meta;\ntry {\n    meta = admin.topics().getPartitionedTopicMetadata(topic);\n} catch (PulsarAdminException.NotFoundException e) {\n    admin.topics().createPartitionedTopic(topic, 4); // create first\n}\nadmin.topics().createMissedPartitions(topic);","typeGuard":null,"tryCatchPattern":"try {\n    admin.topics().createMissedPartitions(topic);\n} catch (PulsarAdminException.NotFoundException e) {\n    // partitioned topic absent: create it first or skip\n}","preventionTips":["Create partitioned topics before attempting to repair partitions","Validate topic names against list-partitioned-topics output","Avoid manual edits to topic metadata"],"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"}