spring-projects/spring-ai · error · RuntimeException

Not supported expression type: {expressionType}

Error message

Not supported expression type: {expressionType}

What it means

GemFireAiSearchFilterExpressionConverter.getOperationSymbol throws RuntimeException when a Filter.Expression type has no GemFire mapping. Supported types are IN, EQ, NE, LT, LTE, GT, GTE, NIN; any other expression type hits the default branch during filter-to-GemFire-OQL conversion.

Source

Thrown at vector-stores/spring-ai-gemfire-store/src/main/java/org/springframework/ai/vectorstore/gemfire/GemFireAiSearchFilterExpressionConverter.java:99

	}

	@Override
	protected void doAddValueRangeSpitter(Filter.Value listValue, StringBuilder context) {
		context.append(" OR ");
	}

	private String getOperationSymbol(Expression exp) {
		return switch (exp.type()) {
			case AND -> " AND ";
			case OR -> " OR ";
			case EQ, IN -> "";
			case NE -> " NOT ";
			case LT -> "}";
			case LTE -> "]";
			case GT -> "{";
			case GTE -> "[";
			case NIN -> "NOT ";
			default -> throw new RuntimeException("Not supported expression type: " + exp.type());
		};
	}

	@Override
	public void doKey(Key key, StringBuilder context) {
		var identifier = key.key();
		emitLuceneString(identifier.trim(), context);
		context.append(":");
	}

	@Override
	protected void doValue(Filter.Value filterValue, StringBuilder context) {
		if (filterValue.value() instanceof List list) {
			int c = 0;
			for (Object v : list) {
				this.doSingleValue(normalizeDateString(v), context);
				if (c++ < list.size() - 1) {
					this.doAddValueRangeSpitter(filterValue, context);

View on GitHub (pinned to 98a7beda4f)

Solutions

  1. Use only supported expression types: IN, EQ, NE, LT, LTE, GT, GTE, NIN with AND/OR grouping
  2. Keep spring-ai-gemfire-store and the Spring AI core versions in sync
  3. Subclass the converter and override getOperationSymbol if custom types must be supported

Example fix

// before: unsupported type
new Filter.Expression(ExpressionType.CONTAINS, key, value);
// after: emulate with supported operators
new Filter.Expression(ExpressionType.EQ, key, value);
Defensive patterns

Strategy: validation

Validate before calling

private static final Set<ExpressionType> SUPPORTED = Set.of(IN, EQ, NE, LT, LTE, GT, GTE, NIN);
if (!SUPPORTED.contains(expression.type())) throw new IllegalArgumentException("GemFire converter does not support: " + expression.type());

Try / catch

try {
    vectorStore.similaritySearch(req.withFilterExpression(expr));
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("Not supported expression type")) {
        throw new IllegalArgumentException("Restrict filter to GemFire-supported operators", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling similaritySearch or delete with a Filter.Expression containing a type outside the supported set (e.g. a custom or newer Filter API expression type) which doExpression routes into getOperationSymbol.

Common situations: Custom predicate types, version mismatch between the Spring AI Filter API and the GemFire store's converter, or hand-built expressions using unsupported semantics.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11). Data as JSON: /api/errors/72e3c2c9aa6c86b2. Report an issue: GitHub.