{"record":{"id":"c531486eb4964e7b","repo":"OtterMind/Chat2DB","slug":"unsupported-snowflake-index-type-indextype","errorCode":null,"errorMessage":"Unsupported Snowflake index type: {indexType}","messagePattern":"Unsupported Snowflake index type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"chat2db-community-server/chat2db-community-plugins/chat2db-community-snowflake/src/main/java/ai/chat2db/plugin/snowflake/builder/SnowflakeSqlBuilder.java","lineNumber":207,"sourceCode":"            script = new StringBuilder(script.substring(0, script.length() - 2));\n            script.append(SQLConstants.SEMICOLON);\n        }\n\n        return script.toString();\n    }\n\n    private SnowflakeColumnTypeEnum requireColumnType(String columnType) {\n        SnowflakeColumnTypeEnum typeEnum = SnowflakeColumnTypeEnum.getByType(columnType);\n        if (typeEnum == null) {\n            throw new IllegalArgumentException(\"Unsupported Snowflake column type: \" + columnType);\n        }\n        return typeEnum;\n    }\n\n    private SnowflakeIndexTypeEnum requireIndexType(String indexType) {\n        SnowflakeIndexTypeEnum typeEnum = SnowflakeIndexTypeEnum.getByType(indexType);\n        if (typeEnum == null) {\n            throw new IllegalArgumentException(\"Unsupported Snowflake index type: \" + indexType);\n        }\n        return typeEnum;\n    }\n\n}\n","sourceCodeStart":189,"sourceCodeEnd":213,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-plugins/chat2db-community-snowflake/src/main/java/ai/chat2db/plugin/snowflake/builder/SnowflakeSqlBuilder.java#L189-L213","documentation":"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.","triggerScenarios":"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').","commonSituations":"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.","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."],"exampleFix":"// before\nidx.setType(\"BTREE\"); // -> Unsupported Snowflake index type\n\n// after\nidx.setType(\"Normal\");","handlingStrategy":"validation","validationCode":"// Validate index type against the canonical names before buildCreateTable\nstatic final Set<String> OK = Set.of(\"Primary\", \"Normal\", \"Unique\", \"Fulltext\", \"Spatial\");\nfor (TableIndex idx : table.getIndexList()) {\n    if (StringUtils.isNotBlank(idx.getType())\n            && OK.stream().noneMatch(n -> n.equalsIgnoreCase(idx.getType()))) {\n        throw new IllegalArgumentException(\"Bad index type: \" + idx.getType());\n    }\n}","typeGuard":"static boolean isSupportedSnowflakeIndexType(String type) {\n    return type != null && SnowflakeIndexTypeEnum.getByType(type) != null;\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["snowflake","ddl","index-type","create-table"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}