apache/pulsar · error · UnsupportedOperationException

The only supported ActionType is DELETE

Error message

The only supported ActionType is DELETE

What it means

validateActionType guards writes to the topic-policies system topic: the PulsarEvent's ActionType is missing or is not DELETE, the only action this writer supports, so the malformed policy event is rejected.

Solutions

  1. Emit only DELETE action events on this code path
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/systopic/TopicPoliciesSystemTopicClient.java:157 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/c39d69e14c2f6f14. Report an issue: GitHub.

Appendix: source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/systopic/TopicPoliciesSystemTopicClient.java:157

                systemTopicClient.getWriters().remove(TopicPolicyWriter.this);
            });
        }

        @Override
        public SystemTopicClient<PulsarEvent> getSystemTopicClient() {
            return systemTopicClient;
        }
    }

    private static void setReplicateCluster(PulsarEvent event, TypedMessageBuilder<PulsarEvent> builder) {
        if (event.getReplicateTo() != null) {
            builder.replicationClusters(new ArrayList<>(event.getReplicateTo()));
        }
    }

    private static void validateActionType(PulsarEvent event) {
        if (event == null || !ActionType.DELETE.equals(event.getActionType())) {
            throw new UnsupportedOperationException("The only supported ActionType is DELETE");
        }
    }

    private static class TopicPolicyReader implements Reader<PulsarEvent> {

        private final org.apache.pulsar.client.api.Reader<PulsarEvent> reader;
        private final TopicPoliciesSystemTopicClient systemTopic;

        private TopicPolicyReader(org.apache.pulsar.client.api.Reader<PulsarEvent> reader,
                                  TopicPoliciesSystemTopicClient systemTopic) {
            this.reader = reader;
            this.systemTopic = systemTopic;
        }

        @Override
        public Message<PulsarEvent> readNext() throws PulsarClientException {
            return reader.readNext();
        }

View on GitHub (pinned to 820761864e)