{"record":{"id":"2fbc3b7a36490b7e","repo":"Tencent/WeKnora","slug":"failed-to-create-collection-w","errorCode":null,"errorMessage":"failed to create collection: %w","messagePattern":"failed to create collection: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/repository/retriever/milvus/repository.go","lineNumber":186,"sourceCode":"\t\tindexOpts := make([]client.CreateIndexOption, 0)\n\t\t// hnsw index for embedding field\n\t\tindexOpts = append(indexOpts, client.NewCreateIndexOption(collectionName, fieldEmbedding, index.NewHNSWIndex(m.metricType, 16, 128)))\n\t\tindexOpts = append(indexOpts, client.NewCreateIndexOption(collectionName, fieldContentSparse, index.NewAutoIndex(entity.BM25)))\n\t\t// Create payload indexes for filtering\n\t\tindexFields := []string{fieldChunkID, fieldKnowledgeID, fieldKnowledgeBaseID, fieldSourceID, fieldIsEnabled}\n\t\tfor _, fieldName := range indexFields {\n\t\t\tindexOpts = append(indexOpts, client.NewCreateIndexOption(collectionName, fieldName, index.NewAutoIndex(entity.IP)))\n\t\t}\n\n\t\t// Create collection\n\t\tcreateOpt := client.NewCreateCollectionOption(collectionName, schema).WithIndexOptions(indexOpts...)\n\t\tif m.shardsNum > 0 {\n\t\t\tcreateOpt = createOpt.WithShardNum(int32(m.shardsNum))\n\t\t}\n\t\terr = m.client.CreateCollection(ctx, createOpt)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"[Milvus] Failed to create collection: %v\", err)\n\t\t\treturn fmt.Errorf(\"failed to create collection: %w\", err)\n\t\t}\n\n\t\tlog.Infof(\"[Milvus] Successfully created collection %s\", collectionName)\n\t}\n\n\tloadOpt := client.NewLoadCollectionOption(collectionName)\n\tif m.replicaNumber > 0 {\n\t\tloadOpt = loadOpt.WithReplica(m.replicaNumber)\n\t}\n\tloadTask, err := m.client.LoadCollection(ctx, loadOpt)\n\tif err != nil {\n\t\tlog.Errorf(\"[Milvus] Failed to load collection: %v\", err)\n\t\treturn fmt.Errorf(\"failed to load collection: %w\", err)\n\t}\n\tif err := loadTask.Await(ctx); err != nil {\n\t\tlog.Errorf(\"[Milvus] Failed to await load collection: %v\", err)\n\t\treturn fmt.Errorf(\"failed to await load collection: %w\", err)\n\t}","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/repository/retriever/milvus/repository.go#L168-L204","documentation":"Milvus collection bootstrap failed at collection creation: the per-dimension collection (with HNSW/BM25/payload indexes) could not be created, so subsequent inserts have nowhere to land and ensureCollection aborts the write path.","triggerScenarios":"Thrown at internal/application/repository/retriever/milvus/repository.go:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped Milvus error (quota, permissions, name conflict)","Verify collection schema/index limits for the configured dimension","Retry after resolving the cluster-side issue"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}