{"record":{"id":"81a954b0e554a69d","repo":"apache/pulsar","slug":"topic-s-is-not-the-partitioned-topic","errorCode":null,"errorMessage":"Topic %s is not the partitioned topic.","messagePattern":"Topic (.+?) is not the partitioned topic\\.","errorType":"http","errorClass":"RestException","httpStatus":409,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java","lineNumber":383,"sourceCode":"    }\n\n    /**\n     * It updates number of partitions of an existing partitioned topic. It requires partitioned-topic to\n     * already exist and number of new partitions must be greater than existing number of partitions. Decrementing\n     * number of partitions requires deletion of topic which is not supported.\n     *\n     * @exception RestException Unprocessable entity, status code: 422. throw it when some pre-check failed.\n     * @exception RestException Internal Server Error, status code: 500. throw it when get unknown Exception\n     */\n    protected @NonNull CompletableFuture<Void> internalUpdatePartitionedTopicAsync(int expectPartitions,\n                                                                                   boolean updateLocal,\n                                                                                   boolean force) {\n        PulsarService pulsarService = pulsar();\n        return pulsarService.getBrokerService().fetchPartitionedTopicMetadataAsync(topicName)\n            .thenCompose(partitionedTopicMetadata -> {\n                int currentMetadataPartitions = partitionedTopicMetadata.partitions;\n                if (currentMetadataPartitions <= 0) {\n                    throw new RestException(Status.CONFLICT /* Unprocessable entity*/,\n                            String.format(\"Topic %s is not the partitioned topic.\", topicName));\n                }\n                if (expectPartitions < currentMetadataPartitions) {\n                    throw new RestException(422 /* Unprocessable entity*/,\n                            String.format(\"Desired partitions %s can't be less than the current partitions %s.\",\n                                    expectPartitions, currentMetadataPartitions));\n                }\n                int brokerMaximumPartitionsPerTopic = pulsarService.getConfiguration()\n                        .getMaxNumPartitionsPerPartitionedTopic();\n                if (brokerMaximumPartitionsPerTopic > 0 && expectPartitions > brokerMaximumPartitionsPerTopic) {\n                    throw new RestException(422 /* Unprocessable entity*/,\n                            String.format(\"Desired partitions %s can't be greater than the maximum partitions per\"\n                                            + \" topic %s.\",\n                                    expectPartitions, brokerMaximumPartitionsPerTopic));\n                }\n                final PulsarAdmin admin;\n                try {\n                    admin = pulsarService.getAdminClient();","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L365-L401","documentation":"internalUpdatePartitionedTopicAsync was invoked on a topic whose metadata shows it is not a partitioned topic; the update-partitions operation requires an existing partitioned topic and is rejected otherwise.","triggerScenarios":"Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:383 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the partitioned topic first with the partitions option","Call the update API on the partitioned topic name, not a partition or plain topic"],"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"}