semaphoreui/semaphore · error
unsupported database driver
Error message
unsupported database driver: %s
What it means
The configured `dialect` value does not match any supported database driver (mysql, postgres, sqlite). The connection-string builder returns 'unsupported database driver: <dialect>' and the caller aborts. Only a specific set of Dialect constants is accepted.
Solutions
- Set `dialect` to exactly one of: mysql, postgres, sqlite (matching DbDriver constants)
- Check for case sensitivity and typos — the switch is exact-match
- If unsure, remove `dialect` entirely so GetDialect infers it from the present mysql/postgres/sqlite section
Example fix
// before (config.json)
{"dialect": "sqlite3", ...}
// after
{"dialect": "sqlite", ...} Defensive patterns
Strategy: validation
Validate before calling
// whitelist accepted dialects before use
var validDialects = map[string]bool{"mysql": true, "postgres": true, "sqlite": true}
if !validDialects[cfg.Dialect] {
return fmt.Errorf("dialect %q not in {mysql,postgres,sqlite}", cfg.Dialect)
} Try / catch
if err := dbSetup(cfg); err != nil {
log.Printf("bad dialect: %v", err)
helpers.WriteErrorStatus(w, err.Error(), http.StatusBadRequest)
return
} Prevention
- Copy dialect values only from official docs (mysql/postgres/sqlite)
- Omit `dialect` to let GetDialect infer it from the configured section
- Add a config linter step to CI that checks dialect values
When it happens
Trigger: conf.Dialect is set to a misspelled or unknown value (e.g. 'sqlite3', 'postgresq', 'mariadb', 'BOLT') so buildConnectionString reaches `default: err = fmt.Errorf("unsupported database driver: %s", d.Dialect)`.
Common situations: Typo in config.json/config.yml dialect field; docs or tutorials referencing old driver names; copy-paste from another project (e.g. 'sqlite3' from GORM-style configs).
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
- database configuration not found
- BoltDB not supported
- migration version is empty
- invalid migration version format
- cannot assign value of type %T to field
AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07).
Data as JSON: /api/errors/9dd53f0af420412d.
Report an issue: GitHub.
Appendix: source
Thrown at util/config.go:2074
connectionString = fmt.Sprintf(
"postgres://%s:%s@%s/%s",
dbUser,
url.QueryEscape(dbPass),
dbHost,
dbName)
} else {
connectionString = fmt.Sprintf(
"postgres://%s:%s@%s/postgres",
dbUser,
url.QueryEscape(dbPass),
dbHost)
}
connectionString += mapToQueryString(d.Options)
case DbDriverSQLite:
connectionString = "file:" + dbHost
connectionString += mapToQueryString(d.Options)
default:
err = fmt.Errorf("unsupported database driver: %s", d.Dialect)
}
return
}
// PrintDbInfo prints the database connection information based on the current configuration.
// It retrieves the database dialect and prints the corresponding connection details.
// If the dialect is not found, it panics with an error message.
func (conf *ConfigType) PrintDbInfo() {
// Get the database dialect
dialect, err := conf.GetDialect()
if err != nil {
panic(err)
}
// Print database connection information based on the dialect
switch dialect {
case DbDriverMySQL:
fmt.Printf("MySQL %v@%v %v\n", conf.MySQL.GetUsername(), conf.MySQL.GetHostname(), conf.MySQL.GetDbName())View on GitHub (pinned to 1774ccb71a)