{"record":{"id":"53f6cbecbae6ecf5","repo":"spring-projects/spring-ai","slug":"unsupported-value-type-for-lte-condition-only-sup","errorCode":null,"errorMessage":"Unsupported value type for LTE condition. Only supports Number","messagePattern":"Unsupported value type for LTE condition\\. Only supports Number","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"vector-stores/spring-ai-qdrant-store/src/main/java/org/springframework/ai/vectorstore/qdrant/QdrantFilterExpressionConverter.java","lineNumber":159,"sourceCode":"\t}\n\n\tprotected Condition buildGteCondition(Key key, Value value) {\n\t\tString identifier = doKey(key);\n\t\tif (value.value() instanceof Number valueNum) {\n\t\t\tDouble dvalue = Double.parseDouble(valueNum.toString());\n\t\t\treturn io.qdrant.client.ConditionFactory.range(identifier, Range.newBuilder().setGte(dvalue).build());\n\t\t}\n\t\tthrow new RuntimeException(\"Unsupported value type for GTE condition. Only supports Number\");\n\n\t}\n\n\tprotected Condition buildLteCondition(Key key, Value value) {\n\t\tString identifier = doKey(key);\n\t\tif (value.value() instanceof Number valueNum) {\n\t\t\tDouble dvalue = Double.parseDouble(valueNum.toString());\n\t\t\treturn io.qdrant.client.ConditionFactory.range(identifier, Range.newBuilder().setLte(dvalue).build());\n\t\t}\n\t\tthrow new RuntimeException(\"Unsupported value type for LTE condition. Only supports Number\");\n\n\t}\n\n\tprotected Condition buildInCondition(Key key, Value value) {\n\t\tif (value.value() instanceof List valueList && !valueList.isEmpty()) {\n\t\t\tObject firstValue = valueList.get(0);\n\t\t\tString identifier = doKey(key);\n\n\t\t\tif (firstValue instanceof String) {\n\t\t\t\t// If the first value is a string, then all values should be strings\n\t\t\t\tList<String> stringValues = new ArrayList<>();\n\t\t\t\tfor (Object valueObj : valueList) {\n\t\t\t\t\tstringValues.add(valueObj.toString());\n\t\t\t\t}\n\t\t\t\treturn io.qdrant.client.ConditionFactory.matchKeywords(identifier, stringValues);\n\t\t\t}\n\t\t\telse if (firstValue instanceof Number) {\n\t\t\t\t// If the first value is a number, then all values should be numbers","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/vector-stores/spring-ai-qdrant-store/src/main/java/org/springframework/ai/vectorstore/qdrant/QdrantFilterExpressionConverter.java#L141-L177","documentation":"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.","triggerScenarios":"Filter.builder().lte(\"score\", \"0.8\").build() — LTE with String, Boolean, or date operand instead of a Number.","commonSituations":"Numeric filters built from user input/config where values remain strings; dates filtered lexically.","solutions":["Use a numeric value for the LTE comparison"],"exampleFix":"// before\nFilter.builder().lte(\"score\", similarityLimit) // String\n// after\nFilter.builder().lte(\"score\", Double.parseDouble(similarityLimit)).build();","handlingStrategy":"validation","validationCode":"static void checkLteOperand(Object v) {\n    if (!(v instanceof Number)) {\n        throw new IllegalArgumentException(\"LTE operand must be a Number, got \" + (v == null ? \"null\" : v.getClass()));\n    }\n}","typeGuard":"static boolean isNumber(Object v) {\n    return v instanceof Number;\n}","tryCatchPattern":"try {\n    vectorStore.similaritySearch(req);\n} catch (RuntimeException ex) {\n    if (ex.getMessage() != null && ex.getMessage().contains(\"LTE condition. Only supports Number\")) {\n        throw new IllegalArgumentException(\"LTE requires a numeric operand\", ex);\n    }\n    throw ex;\n}","preventionTips":["Parse numeric strings before filtering.","Keep numeric metadata numeric at ingestion.","Cover all range filters in unit tests."],"tags":["qdrant","filter-expression","lte","range","spring-ai"],"backgroundTag":"type-mismatch","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"}