{"record":{"id":"2d004342af8820a9","repo":"spring-projects/spring-ai","slug":"failed-to-delete-documents-by-filter-2d0043","errorCode":null,"errorMessage":"Failed to delete documents by filter","messagePattern":"Failed to delete documents by filter","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"vector-stores/spring-ai-weaviate-store/src/main/java/org/springframework/ai/vectorstore/weaviate/WeaviateVectorStore.java","lineNumber":324,"sourceCode":"\n\t\t\tList<Document> matchingDocs = similaritySearch(searchRequest);\n\n\t\t\tif (!matchingDocs.isEmpty()) {\n\t\t\t\tList<String> idsToDelete = matchingDocs.stream().map(Document::getId).toList();\n\n\t\t\t\tdelete(idsToDelete);\n\n\t\t\t\tif (logger.isDebugEnabled()) {\n\t\t\t\t\tlogger.debug(\"Deleted \" + idsToDelete.size() + \" documents matching filter expression\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlogger.debug(\"No documents found matching filter expression\");\n\t\t\t}\n\t\t}\n\t\tcatch (JacksonException e) {\n\t\t\tlogger.error(\"Failed to delete documents by filter\", e);\n\t\t\tthrow new IllegalStateException(\"Failed to delete documents by filter\", e);\n\t\t}\n\t}\n\n\t@Override\n\tpublic List<Document> doSimilaritySearch(SearchRequest request) {\n\n\t\tfloat[] embedding = this.embeddingModel.embed(request.getQuery());\n\n\t\tGetBuilder.GetBuilderBuilder builder = GetBuilder.builder();\n\n\t\tGetBuilderBuilder queryBuilder = builder.className(this.options.getObjectClass())\n\t\t\t.withNearVectorFilter(NearVectorArgument.builder()\n\t\t\t\t.vector(EmbeddingUtils.toFloatArray(embedding))\n\t\t\t\t.certainty((float) request.getSimilarityThreshold())\n\t\t\t\t.build())\n\t\t\t.limit(request.getTopK())\n\t\t\t.withWhereFilter(WhereArgument.builder().build()) // adds an empty 'where:{}'\n\t\t\t// placeholder.","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/vector-stores/spring-ai-weaviate-store/src/main/java/org/springframework/ai/vectorstore/weaviate/WeaviateVectorStore.java#L306-L342","documentation":"doDelete(Filter.Expression) fetches candidate IDs via a GraphQL query, deserializes response JSON with JsonMapper, then deletes. A JacksonException during parsing is rethrown as IllegalStateException('Failed to delete documents by filter'). The response body did not match the expected JSON structure.","triggerScenarios":"VectorStore.delete(Filter.Expression) when the GraphQL _additional id response cannot be parsed — unexpected response shape, Weaviate version returning a different field layout, or truncated/corrupt response.","commonSituations":"Upgrading Weaviate server to a version with changed GraphQL response format while using an older spring-ai-weaviate-store; proxy/gateway returning an HTML error page; empty data maps being interpreted incorrectly.","solutions":["Check server/client version compatibility: align Weaviate server version with the version supported by your spring-ai-weaviate-store release.","Look at the logged stack trace (logger.error already logs it) to see the exact Jackson path that failed.","Capture the raw GraphQL response with curl to compare its shape against the parser's expectations.","If a proxy is in front of Weaviate, bypass it or fix it to return JSON for GraphQL endpoints."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { vectorStore.delete(filterExpr); } catch (IllegalStateException e) { log.error(\"Filter-based delete failed to parse Weaviate response\", e); /* check server/client version alignment */ }","preventionTips":["Keep the Weaviate server version aligned with the spring-ai-weaviate-store release notes","Ensure no proxy rewrites GraphQL responses into HTML error pages","Reproduce the raw GraphQL response with curl when deserialization fails"],"tags":["weaviate","graphql","jackson","deserialization","delete"],"backgroundTag":"unexpected-response-shape","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}