{"record":{"id":"23569ec01f33d877","repo":"spring-projects/spring-ai","slug":"not-supported-expression-type-expressiontype-23569e","errorCode":null,"errorMessage":"Not supported expression type: {expressionType}","messagePattern":"Not supported expression type: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"vector-stores/spring-ai-mariadb-store/src/main/java/org/springframework/ai/vectorstore/mariadb/MariaDBFilterExpressionConverter.java","lineNumber":144,"sourceCode":"\t\t}\n\n\t\tcontext.append(\"'\"); // Closing quote\n\t}\n\n\tprivate String getOperationSymbol(Expression exp) {\n\t\treturn switch (exp.type()) {\n\t\t\tcase AND -> \" AND \";\n\t\t\tcase OR -> \" OR \";\n\t\t\tcase EQ -> \" = \";\n\t\t\tcase NE -> \" != \";\n\t\t\tcase LT -> \" < \";\n\t\t\tcase LTE -> \" <= \";\n\t\t\tcase GT -> \" > \";\n\t\t\tcase GTE -> \" >= \";\n\t\t\tcase IN -> \" IN \";\n\t\t\tcase NOT, NIN -> \" NOT IN \";\n\t\t\t// you never know what the future might bring\n\t\t\tdefault -> throw new RuntimeException(\"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\t// metadataFieldName could contain a malicious character and hence we treat it as\n\t\t// a MariaDB SQL identifier.\n\t\tcontext.append(\"JSON_VALUE(\").append(quoteIdentifier(this.metadataFieldName)).append(\", \");\n\n\t\tStringBuilder jsonKey = new StringBuilder();\n\t\temitJsonValue(key.key(), jsonKey);\n\t\t// Now, the whole JSONPath is emitted as a SQL string\n\t\temitSqlString(\"$.\" + jsonKey.toString(), context);\n\t\tcontext.append(\")\");\n\t}\n\n\t/**\n\t * Quote a SQL identifier using backticks (MySQL/MariaDB standard). Identifiers","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/vector-stores/spring-ai-mariadb-store/src/main/java/org/springframework/ai/vectorstore/mariadb/MariaDBFilterExpressionConverter.java#L126-L162","documentation":"MariaDBFilterExpressionConverter.getOperationSymbol maps Filter.ExpressionType values to SQL operator strings for MariaDB vector search WHERE clauses. If doExpression encounters an expression type not covered by the switch (e.g. NOT is grouped only with NIN, and types like AND/OR are handled elsewhere but an unhandled type slips through), it throws this RuntimeException. It means the filter expression used a comparison operator the MariaDB converter does not support.","triggerScenarios":"Passing a SearchRequest with a FilterExpression built with an expression type not in the switch (e.g. using NOT/NIN semantics incorrectly, or a newly added expression type from a newer spring-ai core version) to MariaDBVectorStore.similaritySearch.","commonSituations":"Upgrading spring-ai core introduces new Filter.ExpressionType values the MariaDB converter doesn't handle yet; building filters programmatically with unsupported operators; typos in custom filter DSL usage.","solutions":["Rewrite the filter expression using only supported operators: EQ, NE, LT, LTE, GT, GTE, IN, NOT IN.","Replace NOT(group) with an equivalent expression using supported operators where possible.","Check the spring-ai version and upgrade the MariaDB store module to match the core version so new expression types are supported.","Add a case to getOperationSymbol if you maintain a fork."],"exampleFix":"// before\nFilterExpression f = new FilterExpressionBuilder().not(\n    new FilterExpressionBuilder().eq(\"genre\", \"news\")).build();\n// after\nFilterExpression f = new FilterExpressionBuilder().ne(\"genre\", \"news\").build();","handlingStrategy":"validation","validationCode":"private static final Set<Filter.ExpressionType> SUPPORTED = Set.of(EQ, NE, LT, LTE, GT, GTE, IN, NIN, AND, OR);\nvoid assertSupported(Filter.Expression e) {\n    if (!SUPPORTED.contains(e.type()))\n        throw new IllegalArgumentException(\"Unsupported for MariaDB: \" + e.type());\n}","typeGuard":null,"tryCatchPattern":"try {\n    vectorStore.similaritySearch(request);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Not supported expression type\")) {\n        // fall back to an unfiltered search or rewrite the filter\n    }\n}","preventionTips":["Keep filter expressions portable and limited to comparison operators.","Avoid FilterExpressionType.NOT on MariaDB; invert the inner condition instead.","Keep spring-ai core and store module versions in lockstep.","Unit-test every filter expression against the target store."],"tags":["filter-expression","mariadb","vector-store","sql"],"backgroundTag":"unsupported-enum-value","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"}