OtterMind/Chat2DB · error · IllegalArgumentException
Unsupported Snowflake index type: {indexType}
Error message
Unsupported Snowflake index type: {indexType} What it means
Thrown by SnowflakeSqlBuilder.requireIndexType during CREATE TABLE generation when an index's type string does not match any SnowflakeIndexTypeEnum name. The match is case-insensitive against the enum 'name' field, whose only legal values are 'Primary', 'Normal', 'Unique', 'Fulltext', and 'Spatial'. A blank name or blank type is silently skipped (line 120-122), but a non-blank unrecognized type fails hard.
Source
Thrown at chat2db-community-server/chat2db-community-plugins/chat2db-community-snowflake/src/main/java/ai/chat2db/plugin/snowflake/builder/SnowflakeSqlBuilder.java:207
script = new StringBuilder(script.substring(0, script.length() - 2));
script.append(SQLConstants.SEMICOLON);
}
return script.toString();
}
private SnowflakeColumnTypeEnum requireColumnType(String columnType) {
SnowflakeColumnTypeEnum typeEnum = SnowflakeColumnTypeEnum.getByType(columnType);
if (typeEnum == null) {
throw new IllegalArgumentException("Unsupported Snowflake column type: " + columnType);
}
return typeEnum;
}
private SnowflakeIndexTypeEnum requireIndexType(String indexType) {
SnowflakeIndexTypeEnum typeEnum = SnowflakeIndexTypeEnum.getByType(indexType);
if (typeEnum == null) {
throw new IllegalArgumentException("Unsupported Snowflake index type: " + indexType);
}
return typeEnum;
}
}
View on GitHub (pinned to 5ee1e990e7)
Solutions
- Set the index type to one of the canonical names: 'Primary', 'Normal', 'Unique', 'Fulltext', or 'Spatial'.
- Map/crosswalk index types from the source dialect before populating the Snowflake TableIndex.
- Leave both name and type blank to have the index skipped rather than throw.
Example fix
// before
idx.setType("BTREE"); // -> Unsupported Snowflake index type
// after
idx.setType("Normal"); Defensive patterns
Strategy: validation
Validate before calling
// Validate index type against the canonical names before buildCreateTable
static final Set<String> OK = Set.of("Primary", "Normal", "Unique", "Fulltext", "Spatial");
for (TableIndex idx : table.getIndexList()) {
if (StringUtils.isNotBlank(idx.getType())
&& OK.stream().noneMatch(n -> n.equalsIgnoreCase(idx.getType()))) {
throw new IllegalArgumentException("Bad index type: " + idx.getType());
}
} Type guard
static boolean isSupportedSnowflakeIndexType(String type) {
return type != null && SnowflakeIndexTypeEnum.getByType(type) != null;
} Prevention
- Map index types from the source dialect to Snowflake canonical names before populating the model.
- Use the enum's getByType for validation at the boundary.
- Leave type blank to skip rather than pass an unrecognized value.
When it happens
Trigger: Calling buildCreateTable with a TableIndex whose getType() is non-blank yet not one of Primary/Normal/Unique/Fulltext/Spatial (e.g. 'BTREE', 'HASH', 'CLUSTERED', or a lowercase 'primary').
Common situations: Copying index metadata from another dialect (MySQL 'BTREE', SQL Server 'CLUSTERED') into the Snowflake model; locale/casing differences; a UI dropdown emitting a label instead of the canonical enum name.
Related errors
- Invalid Snowflake {what}: {value}
- Invalid Snowflake index sort direction: {value}
- Unsupported Snowflake column type: {columnType}
- Snowflake index requires at least one named column
- database.delete.prepareFailed
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/c531486eb4964e7b.
Report an issue: GitHub.