Tencent/WeKnora · error
failed to delete by knowledge IDs
Error message
failed to delete by knowledge IDs: %w
What it means
Milvus delete-by-knowledge-IDs operation failed: the Delete call filtering on knowledge IDs errored, so all indexed points belonging to those documents remain in the collection and the delete is propagated as failed.
Solutions
- Inspect the wrapped Milvus error for the root cause
- Verify collection state for the given dimension
- Retry to avoid orphaned searchable vectors
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/application/repository/retriever/milvus/repository.go:372 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/5bfb1e316cedb42f.
Report an issue: GitHub.
Appendix: source
Thrown at internal/application/repository/retriever/milvus/repository.go:372
// DeleteByKnowledgeIDList removes points from the collection based on knowledge IDs
func (m *milvusRepository) DeleteByKnowledgeIDList(ctx context.Context,
knowledgeIDList []string, dimension int, knowledgeType string,
) error {
log := logger.GetLogger(ctx)
if len(knowledgeIDList) == 0 {
log.Warn("[Milvus] Empty knowledge ID list provided for deletion, skipping")
return nil
}
collectionName := m.getCollectionName(dimension)
log.Infof("[Milvus] Deleting indices by knowledge IDs from %s, count: %d", collectionName, len(knowledgeIDList))
deleteOpt := client.NewDeleteOption(collectionName)
deleteOpt.WithStringIDs(fieldKnowledgeID, knowledgeIDList)
_, err := m.client.Delete(ctx, deleteOpt)
if err != nil {
log.Errorf("[Milvus] Failed to delete by knowledge IDs: %v", err)
return fmt.Errorf("failed to delete by knowledge IDs: %w", err)
}
log.Infof("[Milvus] Successfully deleted documents by knowledge IDs")
return nil
}
// DeleteBySourceIDList removes points from the collection based on source IDs
func (m *milvusRepository) DeleteBySourceIDList(ctx context.Context,
sourceIDList []string, dimension int, knowledgeType string,
) error {
log := logger.GetLogger(ctx)
if len(sourceIDList) == 0 {
log.Warn("[Milvus] Empty source ID list provided for deletion, skipping")
return nil
}
collectionName := m.getCollectionName(dimension)
log.Infof("[Milvus] Deleting indices by source IDs from %s, count: %d", collectionName, len(sourceIDList))View on GitHub (pinned to 988cbb0330)