{"record":{"id":"cdc1b63d06ce7d16","repo":"semaphoreui/semaphore","slug":"database-configuration-not-found","errorCode":null,"errorMessage":"database configuration not found","messagePattern":"database configuration not found","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/config.go","lineNumber":2100,"sourceCode":"func (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())\n\tcase DbDriverBolt:\n\t\tfmt.Printf(\"BoltDB not supported\\n\")\n\tcase DbDriverPostgres:\n\t\tfmt.Printf(\"Postgres %v@%v %v\\n\", conf.Postgres.GetUsername(), conf.Postgres.GetHostname(), conf.Postgres.GetDbName())\n\tcase DbDriverSQLite:\n\t\tfmt.Printf(\"SQLite %v@%v %v\\n\", conf.SQLite.GetUsername(), conf.SQLite.GetHostname(), conf.SQLite.GetDbName())\n\tdefault:\n\t\tpanic(fmt.Errorf(\"database configuration not found\"))\n\t}\n}\n\nfunc (conf *ConfigType) GetDialect() (dialect string, err error) {\n\tif conf.Dialect == \"\" {\n\t\tswitch {\n\t\tcase conf.MySQL.IsPresent():\n\t\t\tdialect = DbDriverMySQL\n\t\tcase conf.Postgres.IsPresent():\n\t\t\tdialect = DbDriverPostgres\n\t\tcase conf.SQLite.IsPresent():\n\t\t\tdialect = DbDriverSQLite\n\t\tdefault:\n\t\t\terr = errors.New(\"database configuration not found\")\n\t\t}\n\t\treturn\n\t}\n","sourceCodeStart":2082,"sourceCodeEnd":2118,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/util/config.go#L2082-L2118","documentation":"Inside PrintDbInfo, after GetDialect succeeded, the dialect value still matches no known driver in the print switch, so Semaphore panics with 'database configuration not found'. This is an internal invariant: a dialect was resolved but is neither mysql, boltdb, postgres, nor sqlite.","triggerScenarios":"PrintDbInfo receives a dialect string that passes GetDialect (conf.Dialect set to a non-empty unknown value like 'foo') but fails the switch, hitting `default: panic(fmt.Errorf(\"database configuration not found\"))`.","commonSituations":"Custom/garbage value in the top-level `dialect` config field that bypasses inference but is not a supported constant; partially-migrated config files.","solutions":["Correct the top-level `dialect` value to one of: mysql, postgres, sqlite (boltdb prints a warning but is unsupported for connections)","Remove the `dialect` field and let GetDialect infer it from the configured database section","Verify the config file actually loaded (a stale Config struct can hold an old dialect value)"],"exampleFix":"// before (config.json)\n{\"dialect\": \"mariadb\", ...}\n// after\n{\"dialect\": \"mysql\", ...}","handlingStrategy":"validation","validationCode":"var known = map[string]bool{\"mysql\": true, \"postgres\": true, \"sqlite\": true, \"bolt\": true}\nif cfg.Dialect != \"\" && !known[cfg.Dialect] {\n    return fmt.Errorf(\"unknown dialect %q\", cfg.Dialect)\n}","typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        if err, ok := r.(error); ok && err.Error() == \"database configuration not found\" {\n            log.Println(\"no valid database configured\")\n            return\n        }\n        panic(r)\n    }\n}()","preventionTips":["Restrict `dialect` to the documented constants","Omit the field entirely to use inference","Re-read the config after edits to avoid stale values"],"tags":["go","database","config","panic","dialect"],"backgroundTag":"invalid-config-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"}