alibaba/spring-ai-alibaba · error · IllegalArgumentException

Unknown vector store type:

Error message

Unknown vector store type: 

What it means

VectorStoreType.of(String) iterates all enum values matching the configured type string; if none matches, it throws IllegalArgumentException. This is a strict enum-parsing guard ensuring only known vector store type identifiers are accepted.

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/rag/vectorstore/VectorStoreType.java:53

	VectorStoreType(String type) {
		this.type = type;
	}

	/**
	 * Converts a string type to its corresponding VectorStoreType enum value.
	 * @param type The string identifier of the vector store type
	 * @return The corresponding VectorStoreType enum value
	 * @throws IllegalArgumentException if the type is not supported
	 */
	public static VectorStoreType of(String type) {
		for (VectorStoreType vectorStoreType : VectorStoreType.values()) {
			if (vectorStoreType.getType().equals(type)) {
				return vectorStoreType;
			}
		}

		throw new IllegalArgumentException("Unknown vector store type: " + type);
	}

}

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Check the canonical type string in VectorStoreType enum and use it exactly (case-sensitive) in configuration
  2. Log/inspect the raw studioProperties.getVectorStoreType() value — it may be blank or contain whitespace
  3. Guard the call: validate the configured value against VectorStoreType.values() before booting

Example fix

// before
studio:
  vector-store:
    type: ElasticSearch
// after
studio:
  vector-store:
    type: elasticsearch
Defensive patterns

Strategy: validation

Validate before calling

String type = studioProperties.getVectorStoreType();
boolean known = Arrays.stream(VectorStoreType.values())
    .anyMatch(t -> t.getType().equals(type));
if (!known) throw new IllegalStateException("Unknown vector store type: " + type);

Try / catch

try {
    VectorStoreType t = VectorStoreType.of(raw);
} catch (IllegalArgumentException e) {
    log.error("Bad vector-store type '{}', valid: {}", raw,
        Arrays.stream(VectorStoreType.values()).map(VectorStoreType::getType).toList());
}

Prevention

When it happens

Trigger: Calling VectorStoreType.of() with any string not exactly equal to one of the enum constants' getType() values — including typos, wrong casing, null, or an empty property.

Common situations: Typo in config such as 'elasticseach' or 'ES' instead of the canonical value; case mismatch ('Elasticsearch'); property left blank; upgrading versions where the accepted identifiers changed.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/e90e9447caaa9763. Report an issue: GitHub.