{"record":{"id":"ea9a97079539b416","repo":"apache/pulsar","slug":"shadow-topic-shadowtopic-not-exists","errorCode":null,"errorMessage":"Shadow topic [${shadowTopic}] not exists.","messagePattern":"Shadow topic \\[(.+?)\\] not exists\\.","errorType":"http","errorClass":"RestException","httpStatus":412,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java","lineNumber":5647,"sourceCode":"            policies.setEntryFilters(null);\n        });\n    }\n\n    protected CompletableFuture<Void> validateShadowTopics(List<String> shadowTopics) {\n        List<CompletableFuture<Void>> futures = new ArrayList<>(shadowTopics.size());\n        for (String shadowTopic : shadowTopics) {\n            try {\n                TopicName shadowTopicName = TopicName.get(shadowTopic);\n                if (!shadowTopicName.isPersistent()) {\n                    return FutureUtil.failedFuture(new RestException(Status.PRECONDITION_FAILED,\n                            \"Only persistent topic can be set as shadow topic\"));\n                }\n                futures.add(pulsar().getNamespaceService().checkTopicExistsAsync(shadowTopicName)\n                        .thenAccept(info -> {\n                            boolean exists = info.isExists();\n                            info.recycle();\n                            if (!exists) {\n                                throw new RestException(Status.PRECONDITION_FAILED,\n                                        \"Shadow topic [\" + shadowTopic + \"] not exists.\");\n                            }\n                        }));\n            } catch (IllegalArgumentException e) {\n                return FutureUtil.failedFuture(new RestException(Status.FORBIDDEN,\n                        \"Invalid shadow topic name: \" + shadowTopic));\n            }\n        }\n        return FutureUtil.waitForAll(futures);\n    }\n\n    protected CompletableFuture<Void> internalSetShadowTopic(List<String> shadowTopics) {\n        if (!topicName.isPersistent()) {\n            return FutureUtil.failedFuture(new RestException(Status.PRECONDITION_FAILED,\n                    \"Only persistent source topic is supported with shadow topics.\"));\n        }\n        if (CollectionUtils.isEmpty(shadowTopics)) {\n            return FutureUtil.failedFuture(new RestException(Status.PRECONDITION_FAILED,","sourceCodeStart":5629,"sourceCodeEnd":5665,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L5629-L5665","documentation":"validateShadowTopics checks each configured shadow topic before applying the policy; the referenced shadow topic does not exist, so the shadow-topic policy is rejected because it would point at a nonexistent source topic.","triggerScenarios":"Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:5647 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the shadow topic before referencing it","Remove the nonexistent name from the shadowTopics list"],"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"}