googleapis/mcp-toolbox · error

failed to add delete operation for document %q: %w

Error message

failed to add delete operation for document %q: %w

What it means

Error "failed to add delete operation for document %q: %w" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/sources/firestore/firestore.go:394

		response["documentData"] = simplifiedData
	}

	return response, nil
}

func (s *Source) DeleteDocuments(ctx context.Context, documentPaths []string) ([]any, error) {
	// Create a BulkWriter to handle multiple deletions efficiently
	bulkWriter := s.FirestoreClient().BulkWriter(ctx)

	// Keep track of jobs for each document
	jobs := make([]*firestore.BulkWriterJob, len(documentPaths))

	// Add all delete operations to the BulkWriter
	for i, path := range documentPaths {
		docRef := s.FirestoreClient().Doc(path)
		job, err := bulkWriter.Delete(docRef)
		if err != nil {
			return nil, fmt.Errorf("failed to add delete operation for document %q: %w", path, err)
		}
		jobs[i] = job
	}

	// End the BulkWriter to execute all operations
	bulkWriter.End()

	// Collect results
	results := make([]any, len(documentPaths))
	for i, job := range jobs {
		docData := make(map[string]any)
		docData["path"] = documentPaths[i]

		// Wait for the job to complete and get the result
		_, err := job.Results()
		if err != nil {
			docData["success"] = false
			docData["error"] = err.Error()

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/sources/firestore/firestore.go:394 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/aecb8afa3781f36e. Report an issue: GitHub.