apache/seatunnel · error · IllegalArgumentException
Invalid metricType '%s' for column '%s'. Valid values are: %
Error message
Invalid metricType '%s' for column '%s'. Valid values are: %s
What it means
VectorIndex.parseMetricType validates the metricType string via MetricType.of(); unsupported values are rethrown as IllegalArgumentException with the column name and all valid MetricType values. Blank/null metric types are permitted (return null), so the throw only happens for invalid non-empty strings.
Source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/VectorIndex.java:134
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())),
exception);
}
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Use a metric type string exactly matching one of the values in the error message (MetricType.values())
- Fix casing/typos and trim whitespace
- Check your SeaTunnel version — the metric may not be supported yet; upgrade or pick a supported one
Example fix
// before
new VectorIndex("idx", "vec", "HNSW", "cosine_sim");
// after
new VectorIndex("idx", "vec", "HNSW", "COSINE"); // value from MetricType.values() Defensive patterns
Strategy: validation
Validate before calling
boolean valid = Arrays.stream(MetricType.values()).anyMatch(t -> t.name().equalsIgnoreCase(metricType.trim()));
if (metricType != null && !metricType.trim().isEmpty() && !valid) throw new IllegalArgumentException("Bad metricType: " + metricType); Try / catch
try { idx = new VectorIndex(name, col, indexType, metric); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Fix metricType for column " + col + ": " + e.getMessage(), e); } Prevention
- Use MetricType enum names exactly as listed in the error message
- Watch for casing differences vs other vector DB vocabularies
- Confirm the metric exists in your SeaTunnel version before configuring it
When it happens
Trigger: Constructing VectorIndex(name, column, indexType, metricType) where metricType is a non-blank string not in MetricType.values() (e.g. "cosine" vs "COSINE", or a metric not supported by this library version).
Common situations: Vector index configs copied from Milvus/other vector DB docs using metric names this library spells differently, wrong case, or newer metric types added upstream but not yet in the local version.
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
- Invalid indexType '%s' for column '%s'. Valid values are: %s
- Unknown format type:
- Unknown ftp connection mode: ${mode}
- input.on-error must be "skip" or "fail".
- input.multiline.match must be "after" or "before".
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/10d60086f1d3f2e0.
Report an issue: GitHub.