{"record":{"id":"6b5bf44f836be287","repo":"spring-projects/spring-ai","slug":"not-supported-expression-type-6b5bf4","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-weaviate-store/src/main/java/org/springframework/ai/vectorstore/weaviate/WeaviateFilterExpressionConverter.java","lineNumber":122,"sourceCode":"\t\t\tthis.convertOperand(exp.right(), context);\n\t\t}\n\t}\n\n\tprivate String getOperationSymbol(Expression exp) {\n\t\treturn switch (exp.type()) {\n\t\t\tcase AND -> \"operator:And \\n\";\n\t\t\tcase OR -> \"operator:Or \\n\";\n\t\t\tcase EQ -> \"operator:Equal \\n\";\n\t\t\tcase NE -> \"operator:NotEqual \\n\";\n\t\t\tcase LT -> \"operator:LessThan \\n\";\n\t\t\tcase LTE -> \"operator:LessThanEqual \\n\";\n\t\t\tcase GT -> \"operator:GreaterThan \\n\";\n\t\t\tcase GTE -> \"operator:GreaterThanEqual \\n\";\n\t\t\tcase IN -> throw new IllegalStateException(\n\t\t\t\t\t\"The 'IN' operator should have been transformed into chain of OR/EQ expressions.\");\n\t\t\tcase NIN -> throw new IllegalStateException(\n\t\t\t\t\t\"The 'NIN' operator should have been transformed into chain of AND/NEQ expressions.\");\n\t\t\tdefault -> throw new UnsupportedOperationException(\"Not supported expression type:\" + exp.type());\n\t\t};\n\t}\n\n\t@Override\n\tprotected void doKey(Key key, StringBuilder context) {\n\t\tvar identifier = (hasOuterQuotes(key.key())) ? removeOuterQuotes(key.key()) : key.key();\n\t\tcontext.append(\"path:[\");\n\t\temitJsonValue(withMetaPrefix(identifier), context);\n\t\tcontext.append(\"] \\n\");\n\t}\n\n\tpublic String withMetaPrefix(String identifier) {\n\t\tif (SYSTEM_IDENTIFIERS.contains(identifier)) {\n\t\t\treturn identifier;\n\t\t}\n\n\t\tif (this.allowedIdentifierNames.contains(identifier)) {\n\t\t\treturn this.metaFieldPrefix + identifier;","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/vector-stores/spring-ai-weaviate-store/src/main/java/org/springframework/ai/vectorstore/weaviate/WeaviateFilterExpressionConverter.java#L104-L140","documentation":"getOperationSymbol's default branch throws UnsupportedOperationException for any Filter.ExpressionType not explicitly mapped to a Weaviate GraphQL where-filter operator (EQ, NE, LT, LTE, GT, GTE; IN/NIN are handled separately). It means the expression contains an operator Weaviate's filter syntax cannot express.","triggerScenarios":"Passing a Filter.Expression with an unmapped type (any operator outside the switch cases) through WeaviateVectorStore similaritySearch or directly into WeaviateFilterExpressionConverter.","commonSituations":"Newer Spring AI Filter.ExpressionType values appearing after a library upgrade without a matching converter update; generic filter code shared across stores passing operators only some stores support.","solutions":["Rewrite the filter using supported operators: EQ, NE, LT, LTE, GT, GTE, and IN/NIN (auto-expanded).","Upgrade spring-ai-weaviate-store in case support for the operator was added in a newer version.","Pre-check expression types per store and route unsupported filters to a store that supports them or fail fast with a clear message."],"exampleFix":"// before\nvar expr = new Filter.Expression(Filter.ExpressionType.CONTAINS, new Key(\"text\"), new Value(\"ai\"));\n// after\nvar expr = new Filter.Expression(Filter.ExpressionType.EQ, new Key(\"text\"), new Value(\"ai\"));","handlingStrategy":"validation","validationCode":"Set<Filter.ExpressionType> WEAVIATE_SUPPORTED = Set.of(EQ, NE, LT, LTE, GT, GTE, IN, NIN); if (!WEAVIATE_SUPPORTED.contains(expr.type())) throw new IllegalArgumentException(\"Weaviate cannot filter on \" + expr.type());","typeGuard":null,"tryCatchPattern":"try { vectorStore.similaritySearch(req); } catch (UnsupportedOperationException e) { if (e.getMessage().startsWith(\"Not supported expression type\")) { /* rewrite filter with supported operators */ } else throw e; }","preventionTips":["Build filters only with EQ/NE/LT/LTE/GT/GTE/IN/NIN for Weaviate","Re-audit filter operators after Spring AI upgrades","Fail fast at filter-construction time with a per-store whitelist"],"tags":["vector-store","filter-expression","weaviate","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}