{"record":{"id":"a9ea45d008b7e952","repo":"semaphoreui/semaphore","slug":"unsupported-database-dialect","errorCode":null,"errorMessage":"Unsupported database dialect","messagePattern":"Unsupported database dialect","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/setup/setup.go","lineNumber":105,"sourceCode":"`\n\n\tvar db int\n\taskValue(dbPrompt, \"1\", &db)\n\n\tswitch db {\n\tcase 1:\n\t\tconf.Dialect = util.DbDriverMySQL\n\t\tscanMySQL(conf)\n\tcase 2:\n\t\tpanic(\"BoltDB is not supported starting from version 2.19\")\n\tcase 3:\n\t\tconf.Dialect = util.DbDriverPostgres\n\t\tscanPostgres(conf)\n\tcase 4:\n\t\tconf.Dialect = util.DbDriverSQLite\n\t\tscanSQLite(conf)\n\tdefault:\n\t\tpanic(\"Unsupported database dialect\")\n\t}\n\n\tdefaultPlaybookPath := filepath.Join(os.TempDir(), \"semaphore\")\n\taskValue(\"Playbook path\", defaultPlaybookPath, &conf.TmpPath)\n\tconf.TmpPath = filepath.Clean(conf.TmpPath)\n\n\taskValue(\"Public URL (optional, example: https://example.com/semaphore)\", \"\", &conf.WebHost)\n\n\taskConfirmation(\"Enable email alerts?\", false, &conf.EmailAlert)\n\tif conf.EmailAlert {\n\t\taskValue(\"Mail server host\", \"localhost\", &conf.EmailHost)\n\t\taskValue(\"Mail server port\", \"25\", &conf.EmailPort)\n\t\taskValue(\"Mail sender address\", \"semaphore@localhost\", &conf.EmailSender)\n\t}\n\n\taskConfirmation(\"Enable telegram alerts?\", false, &conf.TelegramAlert)\n\tif conf.TelegramAlert {\n\t\taskValue(\"Telegram bot token (you can get it from @BotFather)\", \"\", &conf.TelegramToken)","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/cli/setup/setup.go#L87-L123","documentation":"During interactive setup, the database-choice switch has no default dialect; any answer outside 1-4 falls into `default:` and panics with \"Unsupported database dialect\". The prompt's default is \"1\", so this only triggers on explicit invalid input.","triggerScenarios":"Entering a number other than 1-4 (e.g. 5, 0) — or non-numeric input parsed as such — at the \"What database to use\" prompt in `semaphore setup`.","commonSituations":"Scripted setups piping wrong values into stdin; typos; prompts answered from stale automation scripts written for a different prompt order.","solutions":["Rerun `semaphore setup` and answer 1 (MySQL), 3 (PostgreSQL), or 4 (SQLite).","For automation, pipe a valid choice (e.g. `echo 1 | semaphore setup` or here-doc with correct order).","Prefer a pre-written config.json with `database.dialect` set to skip the interactive database prompt.","If input is being parsed oddly, check locale/encoding of the script feeding stdin (CR characters, etc.)."],"exampleFix":"// before\nprintf \"5\\n...\" | semaphore setup\n// after\nprintf \"1\\n...\" | semaphore setup  # 1=MySQL, 3=PostgreSQL, 4=SQLite","handlingStrategy":"validation","validationCode":"// validate the piped answer before running setup:\nif ! echo \"$DB_CHOICE\" | grep -qE '^[1-4]$'; then\n  echo \"invalid database choice: $DB_CHOICE\" >&2; exit 1\nfi","typeGuard":null,"tryCatchPattern":"// Go side: reprompt instead of panicking\nfor db < 1 || db > 4 {\n    askValue(dbPrompt, \"1\", &db)\n}","preventionTips":["Validate any stdin-driven answers in automation scripts before invoking setup.","Watch for stray carriage returns when piping answers from Windows-authored scripts.","Use a config file to bypass the interactive database prompt entirely."],"tags":["cli","setup","database","invalid-input"],"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"}