{"record":{"id":"10d60086f1d3f2e0","repo":"apache/seatunnel","slug":"invalid-metrictype-s-for-column-s-valid-val","errorCode":null,"errorMessage":"Invalid metricType '%s' for column '%s'. Valid values are: %s","messagePattern":"Invalid metricType '(.+?)' for column '(.+?)'\\. Valid values are: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/VectorIndex.java","lineNumber":134,"sourceCode":"        try {\n            return IndexType.of(indexType);\n        } catch (IllegalArgumentException exception) {\n            throw new IllegalArgumentException(\n                    String.format(\n                            \"Invalid indexType '%s' for column '%s'. Valid values are: %s\",\n                            indexType, columnName, Arrays.toString(IndexType.values())),\n                    exception);\n        }\n    }\n\n    private static MetricType parseMetricType(String metricType, String columnName) {\n        if (metricType == null || metricType.trim().isEmpty()) {\n            return null;\n        }\n        try {\n            return MetricType.of(metricType);\n        } catch (IllegalArgumentException exception) {\n            throw new IllegalArgumentException(\n                    String.format(\n                            \"Invalid metricType '%s' for column '%s'. Valid values are: %s\",\n                            metricType, columnName, Arrays.toString(MetricType.values())),\n                    exception);\n        }\n    }\n}\n","sourceCodeStart":116,"sourceCodeEnd":142,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/VectorIndex.java#L116-L142","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nnew VectorIndex(\"idx\", \"vec\", \"HNSW\", \"cosine_sim\");\n// after\nnew VectorIndex(\"idx\", \"vec\", \"HNSW\", \"COSINE\"); // value from MetricType.values()","handlingStrategy":"validation","validationCode":"boolean valid = Arrays.stream(MetricType.values()).anyMatch(t -> t.name().equalsIgnoreCase(metricType.trim()));\nif (metricType != null && !metricType.trim().isEmpty() && !valid) throw new IllegalArgumentException(\"Bad metricType: \" + metricType);","typeGuard":null,"tryCatchPattern":"try { idx = new VectorIndex(name, col, indexType, metric); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(\"Fix metricType for column \" + col + \": \" + e.getMessage(), e); }","preventionTips":["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"],"tags":["vector-index","enum","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}