spring-projects/spring-ai · error · RuntimeException

Unsupported value type for LTE condition. Only supports Numb

Error message

Unsupported value type for LTE condition. Only supports Number

What it means

Filter translation guard in QdrantFilterExpressionConverter.buildLteCondition: an LTE (less-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:159

	}

	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);

			if (firstValue instanceof String) {
				// If the first value is a string, then all values should be strings
				List<String> stringValues = new ArrayList<>();
				for (Object valueObj : valueList) {
					stringValues.add(valueObj.toString());
				}
				return io.qdrant.client.ConditionFactory.matchKeywords(identifier, stringValues);
			}
			else if (firstValue instanceof Number) {
				// If the first value is a number, then all values should be numbers

View on GitHub (pinned to 98a7beda4f)

Solutions

  1. Use a numeric value for the LTE comparison

Example fix

// before
Filter.builder().lte("score", similarityLimit) // String
// after
Filter.builder().lte("score", Double.parseDouble(similarityLimit)).build();
Defensive patterns

Strategy: validation

Validate before calling

static void checkLteOperand(Object v) {
    if (!(v instanceof Number)) {
        throw new IllegalArgumentException("LTE 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("LTE condition. Only supports Number")) {
        throw new IllegalArgumentException("LTE requires a numeric operand", ex);
    }
    throw ex;
}

Prevention

When it happens

Trigger: Filter.builder().lte("score", "0.8").build() — LTE with String, Boolean, or date operand instead of a Number.

Common situations: Numeric filters built from user input/config where values remain strings; dates filtered lexically.

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/53f6cbecbae6ecf5. Report an issue: GitHub.