provectus/kafka-ui · error · ValidationException

Connector with name already exists

Error message

Connector with name %s already exists

What it means

KafkaConnectService.createConnector validates that a connector with the same name does not already exist on the target Kafka Connect cluster before delegating to the Connect REST API's createConnector call. Kafka Connect itself rejects duplicate connector names, so kafka-ui pre-checks via connectorExists and fails fast with a ValidationException instead of surfacing an opaque 409 from the Connect API. The message includes the connector name taken from the request body.

Solutions

  1. Check the existing connector's config first (GET /api/clusters/{cluster}/connects/{connect}/connectors/{name}) and reuse/update it instead of creating a new one.
  2. Use a unique connector name in the request payload.
  3. Make automation idempotent: delete the existing connector before recreating, or treat the 'already exists' response as success.
  4. If the connector should not exist, delete it via the UI or DELETE .../connectors/{name} before re-creating.

Example fix

// before
{
  "name": "orders-sink",
  "config": { "connector.class": "io.debezium.connector.postgresql.PostgresConnector", ... }
}
// after
{
  "name": "orders-sink-v2",
  "config": { "connector.class": "io.debezium.connector.postgresql.PostgresConnector", ... }
}
Defensive patterns

Strategy: validation

Validate before calling

const exists = await fetch(`/api/clusters/${cluster}/connects/${connect}/connectors/${name}`).then(r => r.status !== 404);
if (exists) throw new Error(`Connector ${name} already exists — reuse or rename it`);

Try / catch

try {
  await createConnector(cluster, connect, payload);
} catch (e) {
  if (e.message.includes('already exists')) {
    // treat as idempotent success or update the existing connector
  } else { throw e; }
}

Prevention

When it happens

Trigger: POSTing to the create-connector endpoint (POST /api/clusters/{clusterName}/connects/{connectName}/connectors) when a connector with the submitted 'name' already exists on that Connect cluster; also triggered by retrying a create request that succeeded on a previous attempt.

Common situations: Re-running a connector creation after an earlier attempt partially succeeded; copying an existing connector config and forgetting to change the name; multiple team members provisioning the same connector concurrently; CI/CD pipelines that are not idempotent and re-register connectors on every deploy.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of provectus/kafka-ui@83b5a60cc0 (2026-09-08). Data as JSON: /api/errors/9186721e47164352. Report an issue: GitHub.

Appendix: source

Thrown at kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/KafkaConnectService.java:135

  public Flux<String> getConnectorNamesWithErrorsSuppress(KafkaCluster cluster, String connectName) {
    return getConnectorNames(cluster, connectName).onErrorComplete();
  }

  @SneakyThrows
  private List<String> parseConnectorsNamesStringToList(String json) {
    return objectMapper.readValue(json, new TypeReference<>() {
    });
  }

  public Mono<ConnectorDTO> createConnector(KafkaCluster cluster, String connectName,
                                            Mono<NewConnectorDTO> connector) {
    return api(cluster, connectName)
        .mono(client ->
            connector
                .flatMap(c -> connectorExists(cluster, connectName, c.getName())
                    .map(exists -> {
                      if (Boolean.TRUE.equals(exists)) {
                        throw new ValidationException(
                            String.format("Connector with name %s already exists", c.getName()));
                      }
                      return c;
                    }))
                .map(kafkaConnectMapper::toClient)
                .flatMap(client::createConnector)
                .flatMap(c -> getConnector(cluster, connectName, c.getName()))
        );
  }

  private Mono<Boolean> connectorExists(KafkaCluster cluster, String connectName,
                                        String connectorName) {
    return getConnectorNames(cluster, connectName)
        .any(name -> name.equals(connectorName));
  }

  public Mono<ConnectorDTO> getConnector(KafkaCluster cluster, String connectName,
                                         String connectorName) {

View on GitHub (pinned to 83b5a60cc0)