{"record":{"id":"e1985d9c9fa57445","repo":"spring-projects/spring-ai","slug":"not-supported-expression-type-e1985d","errorCode":null,"errorMessage":"Not supported expression type: ","messagePattern":"Not supported expression type: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"vector-stores/spring-ai-s3-vector-store/src/main/java/org/springframework/ai/vectorstore/s3/S3VectorFilterSearchExpressionConverter.java","lineNumber":59,"sourceCode":"\tpublic S3VectorFilterSearchExpressionConverter() {\n\t\tthis.dateFormat = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss'Z'\");\n\t\tthis.dateFormat.setTimeZone(TimeZone.getTimeZone(\"UTC\"));\n\t}\n\n\tprivate String getOperationSymbol(Filter.ExpressionType exp) {\n\t\treturn switch (exp) {\n\t\t\tcase AND -> \"$and\";\n\t\t\tcase NOT -> \"$not\";\n\t\t\tcase OR -> \"$or\";\n\t\t\tcase EQ -> \"$eq\";\n\t\t\tcase NE -> \"$ne\";\n\t\t\tcase LT -> \"$lt\";\n\t\t\tcase LTE -> \"$lte\";\n\t\t\tcase GT -> \"$gt\";\n\t\t\tcase GTE -> \"$gte\";\n\t\t\tcase NIN -> \"$nin\";\n\t\t\tcase IN -> \"$in\";\n\t\t\tdefault -> throw new UnsupportedOperationException(\"Not supported expression type: \" + exp);\n\t\t};\n\t}\n\n\t@Override\n\tpublic Document convertExpression(Filter.Expression expression) {\n\t\tString operationType = getOperationSymbol(expression.type());\n\t\tswitch (expression.type()) {\n\t\t\tcase EQ:\n\t\t\tcase NE:\n\t\t\tcase GTE:\n\t\t\tcase GT:\n\t\t\tcase LTE:\n\t\t\tcase LT:\n\t\t\t\treturn Document.fromMap(Map.of(((Filter.Key) expression.left()).key(), Document\n\t\t\t\t\t.fromMap(Map.of(operationType, wrapValue(Objects.requireNonNull(expression.right()))))));\n\n\t\t\tcase IN:\n\t\t\tcase NIN:","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/vector-stores/spring-ai-s3-vector-store/src/main/java/org/springframework/ai/vectorstore/s3/S3VectorFilterSearchExpressionConverter.java#L41-L77","documentation":"S3VectorFilterSearchExpressionConverter.getOperationSymbol throws UnsupportedOperationException when a Filter.ExpressionType has no S3 Vectors operator mapping. Only AND, NOT, OR, EQ, NE, LT, LTE, GT, GTE, NIN, IN are supported; anything else (e.g. types added in newer Spring AI versions) falls through to the default branch.","triggerScenarios":"Calling S3VectorStore similaritySearch with a SearchRequest filter expression whose Filter.ExpressionType is not in the switch (e.g. ISNULL/ISNOTNULL, or an enum constant from a newer Spring AI release), which reaches getOperationSymbol via convertExpression.","commonSituations":"Upgrading Spring AI and using new filter operators against the S3 vector store before converter support was added; hand-constructing Filter.Expression objects with exotic types; copying filters built for another store (e.g. PgVector) that supports more operators.","solutions":["Rewrite the filter using only supported operators: EQ, NE, LT, LTE, GT, GTE, IN, NIN, AND, OR, NOT.","Emulate unsupported semantics: replace ISNULL/ISNOTNULL with NE/EQ against null or a sentinel metadata field.","Check your Spring AI version and upgrade, since newer releases expand the supported operator set.","If the type is legitimately needed, implement a custom S3VectorFilterExpressionConverter and register it with the S3VectorStore builder."],"exampleFix":"// before\nnew Filter.Expression(Filter.ExpressionType.ISNULL, new Filter.Key(\"notes\"), null)\n// after\nnew Filter.Expression(Filter.ExpressionType.EQ, new Filter.Key(\"notes\"), new Filter.Value(null))","handlingStrategy":"validation","validationCode":"private static final Set<Filter.ExpressionType> SUPPORTED = Set.of(AND, NOT, OR, EQ, NE, LT, LTE, GT, GTE, NIN, IN);\nif (!SUPPORTED.contains(expr.type())) throw new IllegalArgumentException(\"Unsupported for S3: \" + expr.type());","typeGuard":null,"tryCatchPattern":"try { store.similaritySearch(req); } catch (UnsupportedOperationException e) { log.warn(\"Filter uses unsupported operator: {}\", e.getMessage()); }","preventionTips":["Restrict filter builders to the 11 supported ExpressionTypes when targeting S3 Vectors.","Centralize filter construction in one helper so unsupported operators are caught early.","Re-check supported operators when bumping Spring AI versions."],"tags":["vector-store","filter-expression","unsupported-operator","aws-s3-vectors"],"backgroundTag":"unsupported-operation","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"}