SonarSource/sonarqube · error · java.lang.UnsupportedOperationException
Unknown dialect '%s'
Error message
Unknown dialect '%s'
What it means
TinyIntColumnDef.generateSqlType maps dialects to SMALLINT (PostgreSQL), NUMBER(3) (Oracle) or TINYINT (MsSql, H2). Unknown dialect ids throw UnsupportedOperationException "Unknown dialect '%s'". As with the other column definitions, only the four supported database engines can be migrated.
Source
Thrown at server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/def/TinyIntColumnDef.java:51
*/
@Immutable
public class TinyIntColumnDef extends AbstractColumnDef {
private TinyIntColumnDef(Builder builder) {
super(builder.columnName, builder.isNullable, builder.defaultValue);
}
public static Builder newTinyIntColumnDefBuilder() {
return new Builder();
}
@Override
public String generateSqlType(Dialect dialect) {
return switch (dialect.getId()) {
case PostgreSql.ID -> "SMALLINT";
case Oracle.ID -> "NUMBER(3)";
case MsSql.ID, H2.ID -> "TINYINT";
default -> throw new UnsupportedOperationException(String.format("Unknown dialect '%s'", dialect.getId()));
};
}
public static class Builder extends AbstractIntegerColumnDefBuilder<Builder> {
public TinyIntColumnDef build() {
validateColumnName(columnName);
return new TinyIntColumnDef(this);
}
}
}
View on GitHub (pinned to 184c821202)
Solutions
- Switch to a supported database (PostgreSQL, SQL Server, Oracle, H2 dev-only) in sonar.jdbc.url.
- Verify dialect detection picks the intended implementation (check driver class and URL pattern).
- In tests, use one of the supported Dialect id constants.
- Add a case to TinyIntColumnDef.generateSqlType if introducing a new dialect.
Example fix
// before sonar.jdbc.url=jdbc:mysql://db:3306/sonar?useSSL=false // after sonar.jdbc.url=jdbc:postgresql://db:5432/sonarqube
Defensive patterns
Strategy: validation
Validate before calling
Set<String> supported = Set.of(PostgreSql.ID, Oracle.ID, MsSql.ID, H2.ID);
if (!supported.contains(dialect.getId())) {
throw new IllegalArgumentException("Dialect " + dialect.getId() + " not supported for tinyint columns");
} Try / catch
try {
String sql = tinyIntColumnDef.generateSqlType(dialect);
} catch (UnsupportedOperationException e) {
throw new IllegalStateException("Switch sonar.jdbc.url to a supported database", e);
} Prevention
- Use only supported DB engines in production; validate the URL early in deployment scripts.
- Keep dialect id constants (not raw strings) in tests to avoid typos.
- Add new dialect cases across all column definition classes.
When it happens
Trigger: Migration DDL generation for a TINYINT column when dialect.getId() is not postgresql, oracle, mssql or h2.
Common situations: SonarQube pointed at an unsupported engine like MySQL/MariaDB (where TINYINT would naturally exist); test Dialect stubs with unknown ids; broken dialect resolution from a misconfigured JDBC URL.
Related errors
- Unknown dialect '%s'
- Unsupported dialect id
- Unknown dialect '%s'
- Unsupported dialect id
- Unsupported dialect id
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/8ccd28732629b14d.
Report an issue: GitHub.