SonarSource/sonarqube · error · java.lang.IllegalArgumentException
Unsupported dialect id
Error message
Unsupported dialect id
What it means
TimestampColumnDef.generateSqlType maps dialects to DATETIME (MsSql), TIMESTAMP (6) (Oracle) or TIMESTAMP (H2/PostgreSQL); unknown dialect ids throw IllegalArgumentException "Unsupported dialect id ". It prevents generating timestamp DDL for databases SonarQube migrations do not support.
Source
Thrown at server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/def/TimestampColumnDef.java:55
@Immutable
@Deprecated
public class TimestampColumnDef extends AbstractColumnDef {
private TimestampColumnDef(Builder builder) {
super(builder.columnName, builder.isNullable, null);
}
public static Builder newTimestampColumnDefBuilder() {
return new Builder();
}
@Override
public String generateSqlType(Dialect dialect) {
return switch (dialect.getId()) {
case MsSql.ID -> "DATETIME";
case Oracle.ID -> "TIMESTAMP (6)";
case H2.ID, PostgreSql.ID -> "TIMESTAMP";
default -> throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId());
};
}
public static class Builder {
private String columnName;
private boolean isNullable = true;
public Builder setColumnName(String columnName) {
this.columnName = validateColumnName(columnName);
return this;
}
public Builder setIsNullable(boolean b) {
this.isNullable = b;
return this;
}
public TimestampColumnDef build() {View on GitHub (pinned to 184c821202)
Solutions
- Point sonar.jdbc.url at a supported database: PostgreSQL, SQL Server, Oracle, or H2 (dev).
- Confirm the JDBC driver configuration resolves to the correct Dialect implementation at startup.
- Use supported Dialect constants in tests instead of arbitrary ids.
- Extend the switch with a new case if adding dialect support.
Example fix
// before
String type = new TimestampColumnDef.Builder().build().generateSqlType(new FakeDialect("db2"));
// after
String type = new TimestampColumnDef.Builder().build().generateSqlType(new PostgreSql()); // "TIMESTAMP" Defensive patterns
Strategy: validation
Validate before calling
if (!Stream.of(PostgreSql.ID, H2.ID, MsSql.ID, Oracle.ID).anyMatch(id -> id.equals(dialect.getId()))) {
throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId());
} Try / catch
try {
String sql = timestampColumnDef.generateSqlType(dialect);
} catch (IllegalArgumentException e) {
throw new IllegalStateException("Unsupported database engine for migrations", e);
} Prevention
- Confirm the JDBC driver's URL pattern resolves to a supported Dialect at startup.
- Use supported dialect constants in migration unit tests.
- Cover all *ColumnDef classes when introducing a new dialect.
When it happens
Trigger: Migration DDL generation for a TIMESTAMP column when dialect.getId() is not mssql, oracle, h2 or postgresql.
Common situations: Unsupported DB engine configured (MySQL, etc.); test stubs with unregistered ids; dialect detection returning a bogus id because of a wrong JDBC driver/URL.
Related errors
- Unknown dialect '%s'
- Unsupported dialect id
- Unknown dialect '%s'
- Unknown dialect '%s'
- Unsupported dialect id
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/b8afdbcdfecbe78c.
Report an issue: GitHub.