apache/seatunnel · warning

create index failed, maybe index already exists

Error message

create index failed, maybe index already exists

What it means

During Milvus client initialization the sink attempts to create an index on the target collection. Any exception from createIndex (most commonly that the index already exists, but any error) is swallowed and reduced to this warning. The sink assumes the index exists and continues.

Solutions

  1. Verify the index actually exists on the collection (describeIndex/describeCollection); if it does, the warning is safe to ignore.
  2. If no index exists, inspect the exception cause by temporarily logging 'e' or create the index manually with the desired metric/index type.
  3. Pre-create the index outside SeaTunnel so init doesn't need to create it.
  4. Check Milvus connectivity and credentials if the collection genuinely lacks an index.
Defensive patterns

Strategy: fallback

Validate before calling

// pre-check index existence before running the job
client.describeIndex(
    DescribeIndexReq.builder().collectionName("coll").build());

Try / catch

// treat as benign, but verify index exists afterwards
try { client.createIndex(req); }
catch (Exception e) {
    if (!indexExists(collection)) { throw e; } // only swallow 'already exists'
}

Prevention

When it happens

Trigger: initMilvusClient calls milvusClient.createIndex(...) and the RPC returns an error — index already exists, wrong index params, or a connectivity failure.

Common situations: Re-running a job against a collection whose index was created previously; specifying index params that conflict with an existing index; Milvus temporarily unreachable.

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 apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/e49d4cc39d296751. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-milvus/src/main/java/org/apache/seatunnel/connectors/seatunnel/milvus/sink/MilvusBufferBatchWriter.java:159

                                            .build());
                    List<IndexParam> indexParams = new ArrayList<>();
                    for (String fieldName : describeCollectionResp.getVectorFieldNames()) {
                        IndexParam indexParam =
                                IndexParam.builder()
                                        .fieldName(fieldName)
                                        .metricType(IndexParam.MetricType.COSINE)
                                        .build();
                        indexParams.add(indexParam);
                    }
                    CreateIndexReq createIndexReq =
                            CreateIndexReq.builder()
                                    .collectionName(collectionName)
                                    .indexParams(indexParams)
                                    .build();
                    milvusClient.createIndex(createIndexReq);
                }
            } catch (Exception e) {
                log.warn("create index failed, maybe index already exists");
            }
            if (config.get(LOAD_COLLECTION)
                    && !milvusClient.getLoadState(
                            GetLoadStateReq.builder().collectionName(collectionName).build())) {
                log.info("load collection: " + collectionName);
                milvusClient.loadCollection(
                        LoadCollectionReq.builder().collectionName(collectionName).build());
            }
            log.info("init Milvus client success");
        } catch (Exception e) {
            log.error("init Milvus client failed", e);
            throw new MilvusConnectorException(MilvusConnectionErrorCode.INIT_CLIENT_ERROR, e);
        }
    }

    private Boolean getAutoId(PrimaryKey primaryKey, Boolean enableAutoId) {
        if (null != primaryKey && null != primaryKey.getEnableAutoId()) {
            return primaryKey.getEnableAutoId();

View on GitHub (pinned to cf67b549a7)