Tencent/WeKnora · error

failed to batch save (dimension %d): %w

Error message

failed to batch save (dimension %d): %w

What it means

Milvus batch upsert failed for one dimension group: after collection ensure, the Upsert call for the prepared embedding list errored (network, schema, or quota), aborting the whole batched save for that dimension.

Source

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

	for dimension, embeddings := range embeddingsByDimension {
		if err := m.ensureCollection(ctx, dimension); err != nil {
			return err
		}

		collectionName := m.getCollectionName(dimension)
		n := len(embeddings)
		embeddingDBList := make([]*MilvusVectorEmbedding, 0, n)

		for _, embedding := range embeddings {
			embeddingDB := toMilvusVectorEmbedding(embedding, additionalParams)
			embeddingDB.ID = uuid.New().String()
			embeddingDBList = append(embeddingDBList, embeddingDB)
		}
		opts := createUpsert(collectionName, embeddingDBList)
		_, err := m.client.Upsert(ctx, opts)
		if err != nil {
			log.Errorf("[Milvus] Failed to execute batch operation for dimension %d: %v", dimension, err)
			return fmt.Errorf("failed to batch save (dimension %d): %w", dimension, err)
		}
		totalSaved += n
		log.Infof("[Milvus] Saved %d points to collection %s", n, collectionName)
	}

	log.Infof("[Milvus] Successfully batch saved %d indices", totalSaved)
	return nil
}

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

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Inspect the wrapped Milvus error for schema/limit causes
  2. Check connectivity and collection load state
  3. Retry the batch or split it into smaller upserts
Defensive patterns

Strategy: retry

When it happens

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