spring-projects/spring-ai · warning

Error removing embedding: ${e.getMessage()}

Error message

Error removing embedding: ${e.getMessage()}

What it means

GemFireVectorStore.doDelete issues an HTTP DELETE to the GemFire REST endpoint to remove a document's embedding and swallows any RuntimeException, logging it at WARN level. The delete is best-effort: the method returns normally even when removal failed, so the vector may still exist in the store. This message means the HTTP removal of an embedding did not succeed.

Source

Thrown at vector-stores/spring-ai-gemfire-store/src/main/java/org/springframework/ai/vectorstore/gemfire/GemFireVectorStore.java:262

			.retrieve()
			.bodyToMono(Void.class)
			.onErrorMap(WebClientException.class, this::handleHttpClientException)
			.block();
	}

	@Override
	public void doDelete(List<String> idList) {
		try {
			this.client.method(HttpMethod.DELETE)
				.uri("/" + this.indexName + EMBEDDINGS)
				.body(BodyInserters.fromValue(idList))
				.retrieve()
				.bodyToMono(Void.class)
				.block();
		}
		catch (RuntimeException e) {
			if (logger.isWarnEnabled()) {
				logger.warn("Error removing embedding: " + e.getMessage(), e);
			}
		}
	}

	@Override
	public List<Document> doSimilaritySearch(SearchRequest request) {
		String filterQuery = null;
		if (request.hasFilterExpression()) {
			Assert.notNull(request.getFilterExpression(), "filterExpression should not be null");
			filterQuery = this.filterExpressionConverter.convertExpression(request.getFilterExpression());
		}
		float[] floatVector = this.embeddingModel.embed(request.getQuery());
		List<Document> result = this.client.post()
			.uri("/" + this.indexName + QUERY)
			.contentType(MediaType.APPLICATION_JSON)
			.bodyValue(new QueryRequest(floatVector, request.getTopK(), request.getTopK(), // TopKPerBucket
					true, filterQuery))
			.retrieve()

View on GitHub (pinned to 98a7beda4f)

Solutions

  1. Verify the GemFire server is reachable and the REST endpoint (host/port) configured in GemFireVectorStore.builder() is correct
  2. Check the logged cause (stack trace attached at WARN) for the concrete WebClientResponseException status
  3. Confirm the target region/index exists and the document id was previously added
  4. Retry the delete after restoring connectivity, since the exception is swallowed and never surfaced to the caller

Example fix

// before
gemFireVectorStore.delete(List.of(docId)); // silently ignored on failure

// after
try {
    gemFireVectorStore.delete(List.of(docId));
    if (logger.isDebugEnabled()) { logger.debug("deleted " + docId); }
} catch (Exception e) {
    logger.error("delete reported failure in logs; verify GemFire connectivity", e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// before deleting, check the store is reachable
// e.g. perform a cheap similaritySearch to validate connectivity
List<Document> probe = gemFireVectorStore.similaritySearch(SearchRequest.query("ping").withTopK(1));

Try / catch

try {
    gemFireVectorStore.delete(List.of(id));
} catch (RuntimeException e) {
    logger.error("GemFire delete failed (store logs WARN internally)", e);
}

Prevention

When it happens

Trigger: Calling vectorStore.delete(List.of(id)) (or delete by filter that routes to doDelete) when the GemFire REST call throws a RuntimeException: connection refused, HTTP 4xx/5xx via WebClient (WebClientResponseException), timeouts, or an unreachable locator/region.

Common situations: GemFire server down or restarted; wrong gemfire.host/port configuration; the region does not exist; network/firewall blocking the REST API; authentication changes on the server.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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