apache/cassandra · error · ProtocolException

Event not valid for protocol version

Error message

Event %s not valid for protocol version %s

What it means

When a client REGISTERs for push events (STATUS_UPDATES, SCHEMA_CHANGES, TOPOLOGY_CHANGES), each event type has a minimum protocol version. If the connection's negotiated protocol version is older than an event type's minimumVersion, RegisterMessage throws a ProtocolException listing the event and the version.

Solutions

  1. Upgrade the client driver or explicitly set protocol version to at least the event's minimumVersion (V3+)
  2. Remove the unsupported event types from the registration for old protocol versions
  3. Let the driver negotiate the highest mutually supported protocol version instead of pinning an old one
  4. Check Event.Type.minimumVersion in the protocol docs before subscribing on a given version

Example fix

// before
cluster.setProtocolVersion(V2); // too old for TOPOLOGY_CHANGES
cluster.register(Event.Type.TOPOLOGY_CHANGES);
// after
cluster.setProtocolVersion(V5);
cluster.register(Event.Type.TOPOLOGY_CHANGES);
Defensive patterns

Strategy: validation

Validate before calling

for (Event.Type type : types)
    if (type.minimumVersion.compareTo(connectionVersion) > 0)
        throw new IllegalArgumentException(type + " needs protocol >= " + type.minimumVersion);

Type guard

boolean eventSupported(Event.Type t, ProtocolVersion v) {
    return !t.minimumVersion.isGreaterThan(v);
}

Try / catch

try {
    session.registerEvents(types);
} catch (ProtocolException e) {
    if (e.getMessage().contains("not valid for protocol version"))
        session.registerEvents(types.stream().filter(t -> eventSupported(t, v)).collect(toList()));
    else throw e;
}

Prevention

When it happens

Trigger: Sending a RegisterMessage requesting an event type (e.g. TOPOLOGY_CHANGES, which requires a newer protocol version) over a connection using v1/v2 — e.g. a client configured with protocolVersion = V2 while requesting v3-era events.

Common situations: Legacy driver pinned to an old protocol version after an upgrade; hand-written clients hardcoding event subscriptions copied from newer-driver examples; protocol downgraded for compatibility with other tools.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/c3b6409a32285d60. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/transport/messages/RegisterMessage.java:82

    public final List<Event.Type> eventTypes;

    public RegisterMessage(List<Event.Type> eventTypes)
    {
        super(Message.Type.REGISTER);
        this.eventTypes = eventTypes;
    }

    @Override
    protected Response execute(QueryState state, Dispatcher.RequestTime requestTime, boolean traceRequest)
    {
        assert connection instanceof ServerConnection;
        Connection.Tracker tracker = connection.getTracker();
        assert tracker instanceof Server.ConnectionTracker;
        for (Event.Type type : eventTypes)
        {
            if (type.minimumVersion.isGreaterThan(connection.getVersion()))
                throw new ProtocolException("Event " + type.name() + " not valid for protocol version " + connection.getVersion());
            ((Server.ConnectionTracker) tracker).register(type, connection().channel());
        }
        return new ReadyMessage();
    }

    @Override
    public String toString()
    {
        return "REGISTER " + eventTypes;
    }
}

View on GitHub (pinned to 88fd0f6a0e)