SonarSource/sonarqube · error · java.lang.UnsupportedOperationException
Unknown dialect '%s'
Error message
Unknown dialect '%s'
What it means
DecimalColumnDef.generateSqlType maps a migration Dialect to the SQL type string for a DECIMAL/NUMERIC column. It only supports PostgreSQL, Oracle, MsSql and H2; any other dialect id reaches the default branch and throws UnsupportedOperationException "Unknown dialect '%s'". This indicates a migration is being run against an unsupported or unknown database dialect.
Source
Thrown at server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/def/DecimalColumnDef.java:65
public static Builder newDecimalColumnDefBuilder() {
return new Builder();
}
public int getPrecision() {
return precision;
}
public int getScale() {
return scale;
}
@Override
public String generateSqlType(Dialect dialect) {
return switch (dialect.getId()) {
case PostgreSql.ID, Oracle.ID -> String.format("NUMERIC (%s,%s)", precision, scale);
case MsSql.ID -> String.format("DECIMAL (%s,%s)", precision, scale);
case H2.ID -> "DOUBLE";
default -> throw new UnsupportedOperationException(String.format("Unknown dialect '%s'", dialect.getId()));
};
}
public static class Builder {
@CheckForNull
private String columnName;
private int precision = DEFAULT_PRECISION;
private int scale = DEFAULT_SCALE;
private boolean isNullable = true;
public Builder setColumnName(String columnName) {
this.columnName = validateColumnName(columnName);
return this;
}
public Builder setIsNullable(boolean isNullable) {
this.isNullable = isNullable;
return this;View on GitHub (pinned to 184c821202)
Solutions
- Switch sonar.jdbc.url to a supported database: PostgreSQL, Microsoft SQL Server, Oracle, or the embedded H2 (dev only).
- If you intended a supported DB, verify the dialect detection (sonar.jdbc.driver / URL pattern) so the correct Dialect implementation is resolved.
- In tests, use one of the registered Dialect constants (PostgreSql.ID, Oracle.ID, MsSql.ID, H2.ID) instead of a custom id.
- If adding a new dialect, add the corresponding case to DecimalColumnDef.generateSqlType.
Example fix
// before (sonar.properties) sonar.jdbc.url=jdbc:mysql://db:3306/sonar // after — supported dialect only 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("DB engine " + dialect.getId() + " is not supported by SonarQube");
} Try / catch
try {
String sql = decimalColumnDef.generateSqlType(dialect);
} catch (UnsupportedOperationException e) {
throw new IllegalStateException("Configure a supported DB engine (postgres/mssql/oracle/h2)", e);
} Prevention
- Only use officially supported databases (PostgreSQL, SQL Server, Oracle; H2 for dev).
- In tests, always construct Dialects from the supported ID constants.
- When adding a dialect, update every *ColumnDef.generateSqlType switch, not just one.
When it happens
Trigger: A database migration generates SQL for a decimal column while dialect.getId() returns an id not in {postgresql, oracle, mssql, h2} — e.g. an unsupported engine or a broken dialect lookup.
Common situations: Pointing SonarQube at a database engine it does not support (MySQL, MariaDB, SQLite) via sonar.jdbc.url; a custom/embedded dialect whose id is unrecognized; unit tests passing a stub Dialect with an unregistered id.
Related errors
- Unsupported dialect id
- 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/d4a3f14db9b5e74d.
Report an issue: GitHub.