{"record":{"id":"ce22fa5b2936c432","repo":"spring-projects/spring-ai","slug":"field-0-has-unsupported-type-1","errorCode":null,"errorMessage":"Field {0} has unsupported type {1}","messagePattern":"Field (.+?) has unsupported type (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vector-stores/spring-ai-redis-store/src/main/java/org/springframework/ai/vectorstore/redis/RedisVectorStore.java","lineNumber":711,"sourceCode":"\t\t\t.attributes(vectorAttrs)\n\t\t\t.as(this.embeddingFieldName)\n\t\t\t.build());\n\n\t\tif (!CollectionUtils.isEmpty(this.metadataFields)) {\n\t\t\tfor (MetadataField field : this.metadataFields) {\n\t\t\t\tfields.add(schemaField(field));\n\t\t\t}\n\t\t}\n\t\treturn fields;\n\t}\n\n\tprivate SchemaField schemaField(MetadataField field) {\n\t\tString fieldName = jsonPath(field.name);\n\t\treturn switch (field.fieldType) {\n\t\t\tcase NUMERIC -> NumericField.of(fieldName).as(field.name);\n\t\t\tcase TAG -> TagField.of(fieldName).as(field.name);\n\t\t\tcase TEXT -> TextField.of(fieldName).as(field.name);\n\t\t\tdefault -> throw new IllegalArgumentException(\n\t\t\t\t\tMessageFormat.format(\"Field {0} has unsupported type {1}\", field.name, field.fieldType));\n\t\t};\n\t}\n\n\tprivate VectorAlgorithm vectorAlgorithm() {\n\t\tif (this.vectorAlgorithm == Algorithm.HNSW) {\n\t\t\treturn VectorAlgorithm.HNSW;\n\t\t}\n\t\treturn VectorAlgorithm.FLAT;\n\t}\n\n\tprivate String jsonPath(String field) {\n\t\treturn JSON_PATH_PREFIX + field;\n\t}\n\n\t@Override\n\tpublic VectorStoreObservationContext.Builder createObservationContextBuilder(String operationName) {\n\t\tVectorStoreSimilarityMetric similarityMetric = switch (this.distanceMetric) {","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/vector-stores/spring-ai-redis-store/src/main/java/org/springframework/ai/vectorstore/redis/RedisVectorStore.java#L693-L729","documentation":"RedisVectorStore.schemaField() maps each MetadataField to a RediSearch schema field, supporting only NUMERIC, TAG and TEXT field types. A MetadataField with any other fieldType hits the default branch and throws this IllegalArgumentException. It prevents building an FT.CREATE schema with an unmappable field type.","triggerScenarios":"Constructing the RedisVectorStore with MetadataField instances (via builder metadataFields or an observed metadata mode) whose fieldType is not one of NUMERIC/TAG/TEXT, e.g. a null or custom FieldType value.","commonSituations":"Copy-pasting MetadataField definitions from another vector store that supports more types (e.g. BOOLEAN or CHUNK); refactor renamed/extended FieldType enum; building fields programmatically with a wrong enum constant.","solutions":["Use only FieldType.NUMERIC, FieldType.TAG or FieldType.TEXT when defining metadata fields for the Redis store","Coerce unsupported types: map BOOLEAN to TAG, dates to NUMERIC (epoch) before building the store","Check for null/default FieldType values coming from shared configuration or other store adapters"],"exampleFix":"// before\nnew MetadataField(\"active\", FieldType.BOOLEAN)\n// after\nnew MetadataField(\"active\", FieldType.TAG)","handlingStrategy":"validation","validationCode":"java.util.Set<FieldType> allowed = Set.of(FieldType.NUMERIC, FieldType.TAG, FieldType.TEXT);\nfields.forEach(f -> { if (!allowed.contains(f.fieldType)) throw new IllegalArgumentException(\"Unsupported field type for Redis store: \" + f.fieldType); });","typeGuard":"static boolean isSupportedFieldType(MetadataField f) { return f.fieldType == FieldType.NUMERIC || f.fieldType == FieldType.TAG || f.fieldType == FieldType.TEXT; }","tryCatchPattern":"try { RedisVectorStore.builder().metadataFields(fields).build(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"unsupported type\")) { /* remap field type */ } }","preventionTips":["Define Redis store metadata fields only with NUMERIC/TAG/TEXT","Map BOOLEAN/DATE types to TAG/NUMERIC before configuration","Review field definitions when migrating from other vector stores"],"tags":["redis","vector-store","schema","invalid-enum-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}