{"record":{"id":"0f37635a3012b65c","repo":"spring-projects/spring-ai","slug":"got-an-unexpected-error-s","errorCode":null,"errorMessage":"Got an unexpected error: %s","messagePattern":"Got an unexpected error: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"vector-stores/spring-ai-gemfire-store/src/main/java/org/springframework/ai/vectorstore/gemfire/GemFireVectorStore.java","lineNumber":337,"sourceCode":"\t\tDeleteRequest deleteRequest = new DeleteRequest();\n\t\tthis.client.method(HttpMethod.DELETE)\n\t\t\t.uri(\"/\" + this.indexName)\n\t\t\t.body(BodyInserters.fromValue(deleteRequest))\n\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())","sourceCodeStart":319,"sourceCodeEnd":355,"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#L319-L355","documentation":"GemFireVectorStore.handleHttpClientException translates HTTP client exceptions into RuntimeExceptions. If the caught Throwable is not a WebClientResponseException (e.g. connect errors, timeouts, deserialization failures from WebClient), it throws RuntimeException(\"Got an unexpected error: %s\"). It signals a non-HTTP-response failure during a GemFire REST call.","triggerScenarios":"Any GemFire vector store operation (createIndex, similaritySearch, put/delete) whose WebClient call fails without producing an HTTP response: connection refused, DNS failure, read/write timeout, or response decoding error.","commonSituations":"GemFire REST endpoint URL misconfigured, GemFire server down or firewall blocking, TLS handshake failures, or reactive client timeout settings too low.","solutions":["Read the chained cause (ex) for the underlying connect/timeout error","Verify the GemFire REST endpoint host/port and that the service is reachable (curl the endpoint)","Check DNS, proxy, and TLS configuration between app and GemFire","Increase WebClient connect/read timeouts if failures occur under load"],"exampleFix":"// before: wrong scheme/port\nGemFireVectorStore.builder().host(\"localhost\").port(8080)... \n// after: correct GemFire REST port and reachable host\nGemFireVectorStore.builder().host(\"gemfire-host\").port(7070)...","handlingStrategy":"try-catch","validationCode":"boolean reachable = new Socket().connect(new InetSocketAddress(host, port), 3000); // wrap in try/catch","typeGuard":null,"tryCatchPattern":"try {\n    vectorStore.similaritySearch(request);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Got an unexpected error\")) {\n        logger.error(\"GemFire call failed without HTTP response: {}\", e.getCause(), e);\n    }\n    throw e;\n}","preventionTips":["Health-check the GemFire REST endpoint at startup","Configure sensible WebClient connect/read timeouts","Validate host/port/TLS settings for the target environment"],"tags":["gemfire","http-client","webclient","network","vector-store"],"backgroundTag":"network-request-failed","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"}