spring-projects/spring-ai · error · RuntimeException

Unsupported value type for GTE condition. Only supports Numb

Error message

Unsupported value type for GTE condition. Only supports Number

What it means

Filter translation guard in QdrantFilterExpressionConverter.buildGteCondition: a GTE (greater-than-or-equal) comparison was given a non-Number right-hand value; only numeric range comparisons are supported.

Source

Thrown at vector-stores/spring-ai-qdrant-store/src/main/java/org/springframework/ai/vectorstore/qdrant/QdrantFilterExpressionConverter.java:149

	}

	protected Condition buildLtCondition(Key key, Value value) {
		String identifier = doKey(key);
		if (value.value() instanceof Number valueNum) {
			Double dvalue = Double.parseDouble(valueNum.toString());
			return io.qdrant.client.ConditionFactory.range(identifier, Range.newBuilder().setLt(dvalue).build());
		}
		throw new RuntimeException("Unsupported value type for LT condition. Only supports Number");

	}

	protected Condition buildGteCondition(Key key, Value value) {
		String identifier = doKey(key);
		if (value.value() instanceof Number valueNum) {
			Double dvalue = Double.parseDouble(valueNum.toString());
			return io.qdrant.client.ConditionFactory.range(identifier, Range.newBuilder().setGte(dvalue).build());
		}
		throw new RuntimeException("Unsupported value type for GTE condition. Only supports Number");

	}

	protected Condition buildLteCondition(Key key, Value value) {
		String identifier = doKey(key);
		if (value.value() instanceof Number valueNum) {
			Double dvalue = Double.parseDouble(valueNum.toString());
			return io.qdrant.client.ConditionFactory.range(identifier, Range.newBuilder().setLte(dvalue).build());
		}
		throw new RuntimeException("Unsupported value type for LTE condition. Only supports Number");

	}

	protected Condition buildInCondition(Key key, Value value) {
		if (value.value() instanceof List valueList && !valueList.isEmpty()) {
			Object firstValue = valueList.get(0);
			String identifier = doKey(key);

View on GitHub (pinned to 98a7beda4f)

Solutions

  1. Use a numeric value for the GTE comparison

Example fix

// before
Filter.builder().gte("createdAt", "2024-01-01").build();
// after
Filter.builder().gte("createdAt", 1704067200L).build();
Defensive patterns

Strategy: validation

Validate before calling

static void checkGteOperand(Object v) {
    if (!(v instanceof Number)) {
        throw new IllegalArgumentException("GTE operand must be a Number, got " + (v == null ? "null" : v.getClass()));
    }
}

Type guard

static boolean isNumber(Object v) {
    return v instanceof Number;
}

Try / catch

try {
    vectorStore.similaritySearch(req);
} catch (RuntimeException ex) {
    if (ex.getMessage() != null && ex.getMessage().contains("GTE condition. Only supports Number")) {
        throw new IllegalArgumentException("GTE requires a numeric operand", ex);
    }
    throw ex;
}

Prevention

When it happens

Trigger: Filter.builder().gte("rating", "4").build() or gte("year", true) — GTE with a String, Boolean, date, or null right operand.

Common situations: Same family as GT/LT: dates as ISO strings, numbers arriving as strings from web request parameters.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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