spring-projects/spring-ai · error · IllegalStateException

Failed to delete documents by filter:

Error message

Failed to delete documents by filter: 

What it means

QdrantVectorStore.doDelete issues an async point-delete by filter and requires the returned UpdateResult status to be Completed. If Qdrant reports any other status (e.g. Acknowledged or a failure state), the store throws IllegalStateException 'Failed to delete documents by filter: <status>' because the deletion cannot be confirmed as fully applied.

Solutions

  1. Check Qdrant server logs and cluster health for why the delete did not complete
  2. Retry the delete call after verifying the collection is writable
  3. Verify the collection name and that the filter targets existing points
  4. Pin/upgrade Qdrant server version if a status regression is involved
Defensive patterns

Strategy: retry

Try / catch

try { vectorStore.delete(filterExpr); } catch (IllegalStateException e) { logger.warn("Delete incomplete: {}", e.getMessage()); /* retry with backoff, then check server health */ }

Prevention

When it happens

Trigger: Calling vectorStore.delete(Filter.expression...) where qdrantClient.deleteAsync(...).get() returns an UpdateResult whose status != UpdateStatus.Completed, e.g. the node acknowledged but did not complete the operation.

Common situations: Qdrant cluster degraded/unavailable replicas; collection in a bad state; large filter deletions timing out on write consistency.

Related errors


AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11). Data as JSON: /api/errors/df9816736b1a004e. Report an issue: GitHub.

Appendix: source

Thrown at vector-stores/spring-ai-qdrant-store/src/main/java/org/springframework/ai/vectorstore/qdrant/QdrantVectorStore.java:233

		}
		catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	protected void doDelete(org.springframework.ai.vectorstore.filter.Filter.Expression filterExpression) {
		Assert.notNull(filterExpression, "Filter expression must not be null");

		try {
			Filter filter = this.filterExpressionConverter.convertExpression(filterExpression);

			io.qdrant.client.grpc.Points.UpdateResult response = this.qdrantClient
				.deleteAsync(this.collectionName, filter)
				.get();

			if (response.getStatus() != io.qdrant.client.grpc.Points.UpdateStatus.Completed) {
				throw new IllegalStateException("Failed to delete documents by filter: " + response.getStatus());
			}

			logger.debug("Deleted documents matching filter expression");
		}
		catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error("Failed to delete documents by filter: " + e.getMessage(), e);
			}
			throw new IllegalStateException("Failed to delete documents by filter", e);
		}
	}

	/**
	 * Performs a similarity search on the vector store.
	 * @param request The {@link SearchRequest} object containing the query and other
	 * search parameters.
	 * @return A list of documents that are similar to the query.
	 */

View on GitHub (pinned to 98a7beda4f)