apache/seatunnel · error · IllegalArgumentException

Invalid indexType '%s' for column '%s'. Valid values are: %s

Error message

Invalid indexType '%s' for column '%s'. Valid values are: %s

What it means

VectorIndex.parseIndexType validates the indexType string via IndexType.of(); if the value is not one of the supported enum values it rethrows an IllegalArgumentException listing the column name and all valid values. Null/blank index types are allowed and return null, so only genuinely invalid strings reach this throw.

Source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/VectorIndex.java:119

        // Only for binary vectors
        HAMMING,
        JACCARD,
        ;

        public static MetricType of(String name) {
            return valueOf(name.toUpperCase());
        }
    }

    private static IndexType parseIndexType(String indexType, String columnName) {
        if (indexType == null || indexType.trim().isEmpty()) {
            return null;
        }
        try {
            return IndexType.of(indexType);
        } catch (IllegalArgumentException exception) {
            throw new IllegalArgumentException(
                    String.format(
                            "Invalid indexType '%s' for column '%s'. Valid values are: %s",
                            indexType, columnName, Arrays.toString(IndexType.values())),
                    exception);
        }
    }

    private static MetricType parseMetricType(String metricType, String columnName) {
        if (metricType == null || metricType.trim().isEmpty()) {
            return null;
        }
        try {
            return MetricType.of(metricType);
        } catch (IllegalArgumentException exception) {
            throw new IllegalArgumentException(
                    String.format(
                            "Invalid metricType '%s' for column '%s'. Valid values are: %s",
                            metricType, columnName, Arrays.toString(MetricType.values())),

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set indexType to one of the values listed in the error message (IndexType.values())
  2. Fix case/whitespace issues — trim and match the expected casing exactly
  3. If sourced from config, add validation at parse time using IndexType.of with a friendly fallback

Example fix

// before
new VectorIndex("idx", "vec", "HNSWPROXY", null); // invalid
// after
new VectorIndex("idx", "vec", "HNSW", null); // a value from IndexType.values()
Defensive patterns

Strategy: validation

Validate before calling

boolean valid = Arrays.stream(IndexType.values()).anyMatch(t -> t.name().equalsIgnoreCase(indexType.trim()));
if (indexType != null && !indexType.trim().isEmpty() && !valid) throw new IllegalArgumentException("Bad indexType: " + indexType);

Try / catch

try { idx = new VectorIndex(name, col, indexType, metric); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Fix indexType for column " + col + ": " + e.getMessage(), e); }

Prevention

When it happens

Trigger: Constructing a VectorIndex(name, column, indexType, metricType) with a non-null indexType string that is not in IndexType.values() (wrong case, misspelling, e.g. "hnsw " with trailing whitespace or "HNSW" vs lowercase-only expected values).

Common situations: Vector search config in schema definitions (constraintKeys / vector index options) with a typo'd or wrong-case index type, or configs copied between systems with different index type vocabularies.

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 apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/94ae8752a9de9fe3. Report an issue: GitHub.