spring-projects/spring-ai · error · RuntimeException
Index %s not found: %s
Error message
Index %s not found: %s
What it means
GemFireVectorStore.handleHttpClientException maps a WebClientResponseException with HTTP 404 NOT_FOUND to RuntimeException("Index %s not found: %s") using this.indexName. It means the GemFire REST resource for the configured index does not exist on the server side.
Source
Thrown at vector-stores/spring-ai-gemfire-store/src/main/java/org/springframework/ai/vectorstore/gemfire/GemFireVectorStore.java:341
.retrieve()
.bodyToMono(Void.class)
.onErrorMap(WebClientException.class, this::handleHttpClientException)
.block();
}
/**
* Handles exceptions that occur during HTTP client operations and maps them to
* appropriate runtime exceptions.
* @param ex the exception that occurred during HTTP client operation
* @return a mapped runtime exception corresponding to the HTTP client exception
*/
private Throwable handleHttpClientException(Throwable ex) {
if (!(ex instanceof WebClientResponseException clientException)) {
throw new RuntimeException(String.format("Got an unexpected error: %s", ex));
}
if (clientException.getStatusCode().equals(org.springframework.http.HttpStatus.NOT_FOUND)) {
throw new RuntimeException(String.format("Index %s not found: %s", this.indexName, ex));
}
else if (clientException.getStatusCode().equals(org.springframework.http.HttpStatus.BAD_REQUEST)) {
throw new RuntimeException(String.format("Bad Request: %s", ex));
}
else {
throw new RuntimeException(String.format("Got an unexpected HTTP error: %s", ex));
}
}
@Override
public VectorStoreObservationContext.Builder createObservationContextBuilder(String operationName) {
return VectorStoreObservationContext.builder(VectorStoreProvider.GEMFIRE.value(), operationName)
.collectionName(this.indexName)
.dimensions(this.embeddingModel.dimensions())
.fieldName(EMBEDDINGS);
}
public static class CreateRequest {View on GitHub (pinned to 98a7beda4f)
Solutions
- Create the index before searching, e.g. call vectorStore.afterPropertiesSet()/createIndex or the GemFire REST create-index endpoint
- Verify the configured indexName matches an existing index (query the GemFire REST index endpoint)
- Check you are pointed at the intended GemFire environment/region
Example fix
// before: search against a never-created index
vectorStore.similaritySearch(SearchRequest.query("hello"));
// after: ensure the index exists first
vectorStore.createIndex(); // or set the store to create index at startup
vectorStore.similaritySearch(SearchRequest.query("hello")); Defensive patterns
Strategy: try-catch
Validate before calling
boolean indexReady = vectorStore.isIndexCreated(); // or hit GET /index endpoint; create index if missing before searching
Try / catch
try {
vectorStore.similaritySearch(request);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("Index " + indexName + " not found")) {
vectorStore.createIndex(); // then retry
} else {
throw e;
}
} Prevention
- Always create the GemFire index before the first search
- Verify indexName spelling and target environment
- Automate index provisioning in deployment scripts
When it happens
Trigger: Performing similarity search or other operations against a GemFire REST endpoint where the index named by GemFireVectorStoreOptions.indexName has never been created (or was dropped) on the server.
Common situations: Fresh GemFire deployment without running createIndex, index name typo in config, connecting to the wrong GemFire locator/region environment (dev vs prod), or index removed by an admin.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Bad Request: %s
- Got an unexpected HTTP error: %s
- Index %s does not exist in table %s
- Index not found
- Not supported expression type: {expressionType}
AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11).
Data as JSON: /api/errors/b19d81b29232211b.
Report an issue: GitHub.