SonarSource/sonarqube · error · java.lang.IllegalArgumentException
Unsupported dialect id
Error message
Unsupported dialect id
What it means
IntegerColumnDef.generateSqlType renders the SQL type for an INTEGER column per dialect (INTEGER for PostgreSQL/H2, INT for MsSql, NUMBER(38,0) for Oracle). Unknown dialect ids throw IllegalArgumentException "Unsupported dialect id ". It signals migrations being executed against an unrecognized database.
Source
Thrown at server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/def/IntegerColumnDef.java:48
@Immutable
public class IntegerColumnDef extends AbstractColumnDef {
private IntegerColumnDef(Builder builder) {
super(builder.columnName, builder.isNullable, builder.defaultValue);
}
public static Builder newIntegerColumnDefBuilder() {
return new Builder();
}
@Override
public String generateSqlType(Dialect dialect) {
return switch (dialect.getId()) {
case PostgreSql.ID, H2.ID -> "INTEGER";
case MsSql.ID -> "INT";
case Oracle.ID -> "NUMBER(38,0)";
default -> throw new IllegalArgumentException("Unsupported dialect id " + dialect.getId());
};
}
public static class Builder extends AbstractIntegerColumnDefBuilder<Builder> {
public IntegerColumnDef build() {
validateColumnName(columnName);
return new IntegerColumnDef(this);
}
}
}
View on GitHub (pinned to 184c821202)
Solutions
- Use a supported database (PostgreSQL, SQL Server, Oracle, or H2 for dev); change sonar.jdbc.url accordingly.
- Verify dialect resolution so a supported Dialect is selected at startup (check sonar.jdbc.driver and the URL).
- In unit tests, pass a Dialect whose id is one of the four supported constants.
- Add a case for the new dialect id in IntegerColumnDef if you are extending dialect support.
Example fix
// before
Dialect dialect = new TestDialect("mysql");
columnDef.generateSqlType(dialect); // throws
// after
Dialect dialect = new PostgreSql();
String sql = columnDef.generateSqlType(dialect); // "INTEGER" Defensive patterns
Strategy: validation
Validate before calling
if (!Set.of(PostgreSql.ID, H2.ID, MsSql.ID, Oracle.ID).contains(dialect.getId())) {
throw new IllegalArgumentException("Unsupported dialect for integer columns: " + dialect.getId());
} Try / catch
try {
String sql = integerColumnDef.generateSqlType(dialect);
} catch (IllegalArgumentException e) {
throw new IllegalStateException("Use a supported SonarQube database engine", e);
} Prevention
- Verify sonar.jdbc.url maps to a supported dialect before running migrations.
- Keep test Dialect stubs registered to the four supported ids.
- Add new dialects centrally so all column definitions cover them.
When it happens
Trigger: Generating DDL for an integer column during a migration when dialect.getId() is not postgresql, h2, mssql or oracle.
Common situations: Configuring an unsupported DB engine (MySQL/MariaDB) for SonarQube; a stub Dialect in tests with an unknown id; corrupted dialect detection producing a bogus id.
Related errors
- Unknown dialect '%s'
- Unknown dialect '%s'
- Unsupported dialect id
- Unknown dialect '%s'
- Unsupported dialect id
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/904afbdbd5d4a410.
Report an issue: GitHub.