{"record":{"id":"7c70773976dbd7d8","repo":"gotify/server","slug":"unsupported-dialect","errorCode":null,"errorMessage":"unsupported dialect: ","messagePattern":"unsupported dialect: ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"database/database.go","lineNumber":50,"sourceCode":"// New creates a new wrapper for the gorm database framework.\nfunc New(dialect, connection, defaultUser, defaultPass string, strength int, createDefaultUserIfNotExist bool, now func() time.Time) (*GormDatabase, error) {\n\tcreateDirectoryIfSqlite(dialect, connection)\n\n\tdbLogger := logger.New(gormLogWriter{}, logger.Config{\n\t\tSlowThreshold:             200 * time.Millisecond,\n\t\tLogLevel:                  logger.Warn,\n\t\tIgnoreRecordNotFoundError: true,\n\t\tColorful:                  isatty.IsTerminal(os.Stderr.Fd()),\n\t})\n\tgormConfig := &gorm.Config{\n\t\tLogger:                                   dbLogger,\n\t\tDisableForeignKeyConstraintWhenMigrating: true,\n\t\tTranslateError:                           true,\n\t\tNowFunc:                                  now,\n\t}\n\n\tvar db *gorm.DB\n\terr := errors.New(\"unsupported dialect: \" + dialect)\n\n\tswitch dialect {\n\tcase \"mysql\":\n\t\tdb, err = gorm.Open(mysql.Open(connection), gormConfig)\n\tcase \"postgres\":\n\t\tdb, err = gorm.Open(postgres.Open(connection), gormConfig)\n\tcase \"sqlite3\":\n\t\tdb, err = gorm.Open(sqlite.Open(connection), gormConfig)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsqldb, err := db.DB()\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/gotify/server/blob/14bfc256276775c425f988d621dccfe705de18ac/database/database.go#L32-L68","documentation":"New() in database/database.go fails when the dialect argument passed by the caller is not one of the gorm-supported dialects (sqlite, mysql, postgres, etc.). The empty message indicates the dialect string was empty or unrecognized, so gorm.Open cannot select a driver and initialization aborts before any DB handle exists.","triggerScenarios":"Thrown at database/database.go:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a supported dialect string (e.g. \"sqlite3\", \"mysql\", \"postgres\") from the configuration in serve or the test setup","Validate the dialect value against the known list before calling New and fail with a clear config error","Log or surface the offending dialect value in the error message to make misconfiguration obvious"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"14bfc256276775c425f988d621dccfe705de18ac","analyzedAt":"2026-09-05T12:52:36.781Z","contentChangedAt":"2026-09-05T12:52:36.781Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}