{"record":{"id":"9dd53f0af420412d","repo":"semaphoreui/semaphore","slug":"unsupported-database-driver-s","errorCode":null,"errorMessage":"unsupported database driver: %s","messagePattern":"unsupported database driver: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/config.go","lineNumber":2074,"sourceCode":"\t\t\tconnectionString = fmt.Sprintf(\n\t\t\t\t\"postgres://%s:%s@%s/%s\",\n\t\t\t\tdbUser,\n\t\t\t\turl.QueryEscape(dbPass),\n\t\t\t\tdbHost,\n\t\t\t\tdbName)\n\t\t} else {\n\t\t\tconnectionString = fmt.Sprintf(\n\t\t\t\t\"postgres://%s:%s@%s/postgres\",\n\t\t\t\tdbUser,\n\t\t\t\turl.QueryEscape(dbPass),\n\t\t\t\tdbHost)\n\t\t}\n\t\tconnectionString += mapToQueryString(d.Options)\n\tcase DbDriverSQLite:\n\t\tconnectionString = \"file:\" + dbHost\n\t\tconnectionString += mapToQueryString(d.Options)\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported database driver: %s\", d.Dialect)\n\t}\n\treturn\n}\n\n// PrintDbInfo prints the database connection information based on the current configuration.\n// It retrieves the database dialect and prints the corresponding connection details.\n// If the dialect is not found, it panics with an error message.\nfunc (conf *ConfigType) PrintDbInfo() {\n\t// Get the database dialect\n\tdialect, err := conf.GetDialect()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Print database connection information based on the dialect\n\tswitch dialect {\n\tcase DbDriverMySQL:\n\t\tfmt.Printf(\"MySQL %v@%v %v\\n\", conf.MySQL.GetUsername(), conf.MySQL.GetHostname(), conf.MySQL.GetDbName())","sourceCodeStart":2056,"sourceCodeEnd":2092,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/util/config.go#L2056-L2092","documentation":"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.","triggerScenarios":"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)`.","commonSituations":"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).","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"],"exampleFix":"// before (config.json)\n{\"dialect\": \"sqlite3\", ...}\n// after\n{\"dialect\": \"sqlite\", ...}","handlingStrategy":"validation","validationCode":"// whitelist accepted dialects before use\nvar validDialects = map[string]bool{\"mysql\": true, \"postgres\": true, \"sqlite\": true}\nif !validDialects[cfg.Dialect] {\n    return fmt.Errorf(\"dialect %q not in {mysql,postgres,sqlite}\", cfg.Dialect)\n}","typeGuard":null,"tryCatchPattern":"if err := dbSetup(cfg); err != nil {\n    log.Printf(\"bad dialect: %v\", err)\n    helpers.WriteErrorStatus(w, err.Error(), http.StatusBadRequest)\n    return\n}","preventionTips":["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"],"tags":["go","database","config","dialect","invalid-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa","analyzedAt":"2026-09-07T11:00:33.293Z","contentChangedAt":"2026-09-07T11:00:33.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}