{"record":{"id":"e49d4cc39d296751","repo":"apache/seatunnel","slug":"create-index-failed-maybe-index-already-exists","errorCode":null,"errorMessage":"create index failed, maybe index already exists","messagePattern":"create index failed, maybe index already exists","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-milvus/src/main/java/org/apache/seatunnel/connectors/seatunnel/milvus/sink/MilvusBufferBatchWriter.java","lineNumber":159,"sourceCode":"                                            .build());\n                    List<IndexParam> indexParams = new ArrayList<>();\n                    for (String fieldName : describeCollectionResp.getVectorFieldNames()) {\n                        IndexParam indexParam =\n                                IndexParam.builder()\n                                        .fieldName(fieldName)\n                                        .metricType(IndexParam.MetricType.COSINE)\n                                        .build();\n                        indexParams.add(indexParam);\n                    }\n                    CreateIndexReq createIndexReq =\n                            CreateIndexReq.builder()\n                                    .collectionName(collectionName)\n                                    .indexParams(indexParams)\n                                    .build();\n                    milvusClient.createIndex(createIndexReq);\n                }\n            } catch (Exception e) {\n                log.warn(\"create index failed, maybe index already exists\");\n            }\n            if (config.get(LOAD_COLLECTION)\n                    && !milvusClient.getLoadState(\n                            GetLoadStateReq.builder().collectionName(collectionName).build())) {\n                log.info(\"load collection: \" + collectionName);\n                milvusClient.loadCollection(\n                        LoadCollectionReq.builder().collectionName(collectionName).build());\n            }\n            log.info(\"init Milvus client success\");\n        } catch (Exception e) {\n            log.error(\"init Milvus client failed\", e);\n            throw new MilvusConnectorException(MilvusConnectionErrorCode.INIT_CLIENT_ERROR, e);\n        }\n    }\n\n    private Boolean getAutoId(PrimaryKey primaryKey, Boolean enableAutoId) {\n        if (null != primaryKey && null != primaryKey.getEnableAutoId()) {\n            return primaryKey.getEnableAutoId();","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-milvus/src/main/java/org/apache/seatunnel/connectors/seatunnel/milvus/sink/MilvusBufferBatchWriter.java#L141-L177","documentation":"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.","triggerScenarios":"initMilvusClient calls milvusClient.createIndex(...) and the RPC returns an error — index already exists, wrong index params, or a connectivity failure.","commonSituations":"Re-running a job against a collection whose index was created previously; specifying index params that conflict with an existing index; Milvus temporarily unreachable.","solutions":["Verify the index actually exists on the collection (describeIndex/describeCollection); if it does, the warning is safe to ignore.","If no index exists, inspect the exception cause by temporarily logging 'e' or create the index manually with the desired metric/index type.","Pre-create the index outside SeaTunnel so init doesn't need to create it.","Check Milvus connectivity and credentials if the collection genuinely lacks an index."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// pre-check index existence before running the job\nclient.describeIndex(\n    DescribeIndexReq.builder().collectionName(\"coll\").build());","typeGuard":null,"tryCatchPattern":"// treat as benign, but verify index exists afterwards\ntry { client.createIndex(req); }\ncatch (Exception e) {\n    if (!indexExists(collection)) { throw e; } // only swallow 'already exists'\n}","preventionTips":["Pre-create collections and indexes with explicit index params before running pipelines","Keep index definitions in infrastructure-as-code so jobs don't need to create them","After the warning, confirm the index exists via describeIndex"],"tags":["milvus","index","idempotency","sink"],"backgroundTag":"file-already-exists","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}