Tencent/WeKnora · error

failed to delete by chunk IDs

Error message

failed to delete by chunk IDs: %w

What it means

Milvus delete-by-chunk-IDs operation failed: the Delete call with the string ID filter errored (connectivity, collection state, or filter rejection), so the indexed points for those chunks are not removed.

Solutions

  1. Inspect the wrapped Milvus error
  2. Verify the collection exists and is loaded for the dimension
  3. Retry deletion; stale points otherwise remain searchable
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/application/repository/retriever/milvus/repository.go:347 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/8e54a1739b98ef57. Report an issue: GitHub.

Appendix: source

Thrown at internal/application/repository/retriever/milvus/repository.go:347

}

// DeleteByChunkIDList removes points from the collection based on chunk IDs
func (m *milvusRepository) DeleteByChunkIDList(ctx context.Context, chunkIDList []string, dimension int, knowledgeType string) error {
	log := logger.GetLogger(ctx)
	if len(chunkIDList) == 0 {
		log.Warn("[Milvus] Empty chunk ID list provided for deletion, skipping")
		return nil
	}

	collectionName := m.getCollectionName(dimension)
	log.Infof("[Milvus] Deleting indices by chunk IDs from %s, count: %d", collectionName, len(chunkIDList))

	deleteOpt := client.NewDeleteOption(collectionName)
	deleteOpt.WithStringIDs(fieldChunkID, chunkIDList)
	_, err := m.client.Delete(ctx, deleteOpt)
	if err != nil {
		log.Errorf("[Milvus] Failed to delete by chunk IDs: %v", err)
		return fmt.Errorf("failed to delete by chunk IDs: %w", err)
	}

	log.Infof("[Milvus] Successfully deleted documents by chunk IDs")
	return nil
}

// 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))

View on GitHub (pinned to 988cbb0330)