SonarSource/sonarqube · error · java.lang.IllegalArgumentException
Unsupported dialect id
Error message
Unsupported dialect id
What it means
Thrown by CreateTableBuilder.appendColumnFlags when generating auto-increment SQL for a dialect the builder does not recognize. Supported dialects for the IDENTITY/AUTO_INCREMENT branch are a fixed set (e.g. MsSql, H2); anything else hits the default case.
Source
Thrown at server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/sql/CreateTableBuilder.java:212
private void appendColumnFlags(StringBuilder res, Dialect dialect, ColumnDef columnDef) {
Collection<ColumnFlag> columnFlags = this.flagsByColumn.get(columnDef);
if (columnFlags.contains(ColumnFlag.AUTO_INCREMENT)) {
switch (dialect.getId()) {
case Oracle.ID:
// no auto increment on Oracle, must use a sequence
break;
case PostgreSql.ID:
// no specific clause on PostgreSQL but a specific type
break;
case MsSql.ID:
res.append(" IDENTITY (1,1)");
break;
case H2.ID:
res.append(" AUTO_INCREMENT (1,1)");
break;
default:
throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId());
}
}
}
private void appendPkConstraint(StringBuilder res) {
if (pkColumnDefs.isEmpty()) {
return;
}
res.append(", ");
res.append("CONSTRAINT ");
appendPkConstraintName(res);
res.append(" PRIMARY KEY ");
res.append('(');
appendColumnNames(res, pkColumnDefs);
res.append(')');
}
private void appendPkConstraintName(StringBuilder res) {View on GitHub (pinned to 184c821202)
Solutions
- Use a supported database/dialect id (PostgreSQL, MySQL, MsSql, Oracle, H2).
- Fix the dialect configuration so dialect.getId() returns a known id.
- Extend the switch in CreateTableBuilder if adding a new dialect.
Example fix
// before sonar.jdbc.url=jdbc:db2://localhost:50000/sonar // after sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonar
Defensive patterns
Strategy: validation
Validate before calling
Set<String> supported = Set.of(PostgreSql.ID, MySql.ID, MsSql.ID, Oracle.ID, H2.ID); if (!supported.contains(dialect.getId())) { fail("unsupported dialect " + dialect.getId()); } Prevention
- Deploy only on officially supported databases
- Log dialect.getId() at migration start for diagnosability
- Extend builder switches whenever a new dialect is introduced
When it happens
Trigger: Creating a table with an auto-increment column while the configured sonar dialect id is unsupported/unknown for that flag.
Common situations: Custom or misconfigured DatabaseDialect with an id not matching supported constants; running SonarQube against an officially unsupported database; dialect enum updated but builder switch not extended.
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
- Unknown dialect '%s'
- Unsupported dialect id
- Unknown dialect '%s'
- Unsupported dialect id
- Unknown dialect '%s'
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/4a5b2187ec7f47b9.
Report an issue: GitHub.