spring-projects/spring-ai · error · IllegalStateException
Failed to delete documents by filter
Error message
Failed to delete documents by filter
What it means
doDelete wraps the whole asynchronous delete-by-filter in a try/catch; any Exception (client errors, connection failures, interrupted/execution exceptions from the future, invalid filter) is logged and rethrown as IllegalStateException 'Failed to delete documents by filter' with the original cause attached. It is the generic failure path for filter-based deletion in QdrantVectorStore.
Solutions
- Inspect the wrapped cause via e.getCause() to find the underlying gRPC/connection error
- Verify Qdrant host/port and connectivity (qdrantClient.listCollections() as smoke test)
- Confirm the collection name matches an existing Qdrant collection
- Catch IllegalStateException around delete() and retry with backoff for transient network issues
Example fix
// before
vectorStore.delete(filterExpression);
// after
try {
vectorStore.delete(filterExpression);
} catch (IllegalStateException e) {
logger.error("Delete failed: {}", e.getCause());
} Defensive patterns
Strategy: try-catch
Validate before calling
// smoke test before deletes assertDoesNotThrow(() -> qdrantClient.listCollectionsAsync().get());
Try / catch
try { vectorStore.delete(filterExpr); } catch (IllegalStateException e) { Throwable cause = e.getCause(); logger.error("Delete failed due to {}", cause == null ? e : cause.getMessage()); } Prevention
- Log and inspect getCause() for the real gRPC error
- Verify Qdrant connectivity and collection existence at startup
- Apply exponential backoff retries for transient network failures
When it happens
Trigger: qdrantClient.deleteAsync(...).get() throwing: connection refused/timeout, gRPC errors (collection not found, permission), or InterruptedException while waiting for the future.
Common situations: Wrong collection name or collection deleted; Qdrant unreachable (wrong host/port, network); invalid filter expression producing a server error; client bean misconfigured.
Related errors
- Failed to delete documents by filter:
- Non AND/OR/NOT expression must have Value right argument!
- Unsupported Qdrant value type:
- Unsupported value in NIN value list. Only supports String…
- Unsupported value type for NIN condition. Only supports…
AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11).
Data as JSON: /api/errors/98c91e3630548aa3.
Report an issue: GitHub.
Appendix: source
Thrown at vector-stores/spring-ai-qdrant-store/src/main/java/org/springframework/ai/vectorstore/qdrant/QdrantVectorStore.java:242
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.
*/
@Override
public List<Document> doSimilaritySearch(SearchRequest request) {
try {
Filter filter = (request.getFilterExpression() != null)
? this.filterExpressionConverter.convertExpression(request.getFilterExpression())
: Filter.getDefaultInstance();
float[] queryEmbedding = this.embeddingModel.embed(request.getQuery());
View on GitHub (pinned to 98a7beda4f)