{"record":{"id":"b19d81b29232211b","repo":"spring-projects/spring-ai","slug":"index-s-not-found-s","errorCode":null,"errorMessage":"Index %s not found: %s","messagePattern":"Index (.+?) not found: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":404,"severity":"error","filePath":"vector-stores/spring-ai-gemfire-store/src/main/java/org/springframework/ai/vectorstore/gemfire/GemFireVectorStore.java","lineNumber":341,"sourceCode":"\t\t\t.retrieve()\n\t\t\t.bodyToMono(Void.class)\n\t\t\t.onErrorMap(WebClientException.class, this::handleHttpClientException)\n\t\t\t.block();\n\t}\n\n\t/**\n\t * Handles exceptions that occur during HTTP client operations and maps them to\n\t * appropriate runtime exceptions.\n\t * @param ex the exception that occurred during HTTP client operation\n\t * @return a mapped runtime exception corresponding to the HTTP client exception\n\t */\n\tprivate Throwable handleHttpClientException(Throwable ex) {\n\t\tif (!(ex instanceof WebClientResponseException clientException)) {\n\t\t\tthrow new RuntimeException(String.format(\"Got an unexpected error: %s\", ex));\n\t\t}\n\n\t\tif (clientException.getStatusCode().equals(org.springframework.http.HttpStatus.NOT_FOUND)) {\n\t\t\tthrow new RuntimeException(String.format(\"Index %s not found: %s\", this.indexName, ex));\n\t\t}\n\t\telse if (clientException.getStatusCode().equals(org.springframework.http.HttpStatus.BAD_REQUEST)) {\n\t\t\tthrow new RuntimeException(String.format(\"Bad Request: %s\", ex));\n\t\t}\n\t\telse {\n\t\t\tthrow new RuntimeException(String.format(\"Got an unexpected HTTP error: %s\", ex));\n\t\t}\n\t}\n\n\t@Override\n\tpublic VectorStoreObservationContext.Builder createObservationContextBuilder(String operationName) {\n\t\treturn VectorStoreObservationContext.builder(VectorStoreProvider.GEMFIRE.value(), operationName)\n\t\t\t.collectionName(this.indexName)\n\t\t\t.dimensions(this.embeddingModel.dimensions())\n\t\t\t.fieldName(EMBEDDINGS);\n\t}\n\n\tpublic static class CreateRequest {","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/vector-stores/spring-ai-gemfire-store/src/main/java/org/springframework/ai/vectorstore/gemfire/GemFireVectorStore.java#L323-L359","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: search against a never-created index\nvectorStore.similaritySearch(SearchRequest.query(\"hello\"));\n// after: ensure the index exists first\nvectorStore.createIndex(); // or set the store to create index at startup\nvectorStore.similaritySearch(SearchRequest.query(\"hello\"));","handlingStrategy":"try-catch","validationCode":"boolean indexReady = vectorStore.isIndexCreated(); // or hit GET /index endpoint; create index if missing before searching","typeGuard":null,"tryCatchPattern":"try {\n    vectorStore.similaritySearch(request);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Index \" + indexName + \" not found\")) {\n        vectorStore.createIndex(); // then retry\n    } else {\n        throw e;\n    }\n}","preventionTips":["Always create the GemFire index before the first search","Verify indexName spelling and target environment","Automate index provisioning in deployment scripts"],"tags":["gemfire","http-404","index","vector-store","rest-client"],"backgroundTag":"resource-not-found","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}