Error in migrating to new Kafka Connect version

We are migrating some connectors and get the following errors

message": "Unrecognized field \"initial_state\" (class org.apache.kafka.connect.runtime.rest.entities.CreateConnectorRequest), not marked as ignorable

The error is coming from the connect framework because it cannot understand the request to create connectors.

I think the most probable cause is that you have mixed versions of Connect worker nodes, some of which are on version 3.7.0 or greater (3.8.1 seems to be the one the logs are coming from) and some of which are on an older version than 3.7.0.

Up until Kafka 3.6.x, the request to create a connector supported only this form:

{    "name": "[NAME]",    "config": {[CONNECTOR_CONFGIS]}}

With Kafka 3.7.x the initial_state attribute was introduced, so the contract could be extended to:

{    "name": "[NAME]",    "config": {[CONNECTOR_CONFGIS]},    "initial_state": "[STATE]"}

But such a request won’t be accepted by older clients.