semaphoreui/semaphore · error

Unsupported database dialect

Error message

Unsupported database dialect

What it means

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.

Solutions

  1. Rerun `semaphore setup` and answer 1 (MySQL), 3 (PostgreSQL), or 4 (SQLite).
  2. For automation, pipe a valid choice (e.g. `echo 1 | semaphore setup` or here-doc with correct order).
  3. Prefer a pre-written config.json with `database.dialect` set to skip the interactive database prompt.
  4. If input is being parsed oddly, check locale/encoding of the script feeding stdin (CR characters, etc.).

Example fix

// before
printf "5\n..." | semaphore setup
// after
printf "1\n..." | semaphore setup  # 1=MySQL, 3=PostgreSQL, 4=SQLite
Defensive patterns

Strategy: validation

Validate before calling

// validate the piped answer before running setup:
if ! echo "$DB_CHOICE" | grep -qE '^[1-4]$'; then
  echo "invalid database choice: $DB_CHOICE" >&2; exit 1
fi

Try / catch

// Go side: reprompt instead of panicking
for db < 1 || db > 4 {
    askValue(dbPrompt, "1", &db)
}

Prevention

When it happens

Trigger: 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`.

Common situations: Scripted setups piping wrong values into stdin; typos; prompts answered from stale automation scripts written for a different prompt order.

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


AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07). Data as JSON: /api/errors/a9ea45d008b7e952. Report an issue: GitHub.

Appendix: source

Thrown at cli/setup/setup.go:105

`

	var db int
	askValue(dbPrompt, "1", &db)

	switch db {
	case 1:
		conf.Dialect = util.DbDriverMySQL
		scanMySQL(conf)
	case 2:
		panic("BoltDB is not supported starting from version 2.19")
	case 3:
		conf.Dialect = util.DbDriverPostgres
		scanPostgres(conf)
	case 4:
		conf.Dialect = util.DbDriverSQLite
		scanSQLite(conf)
	default:
		panic("Unsupported database dialect")
	}

	defaultPlaybookPath := filepath.Join(os.TempDir(), "semaphore")
	askValue("Playbook path", defaultPlaybookPath, &conf.TmpPath)
	conf.TmpPath = filepath.Clean(conf.TmpPath)

	askValue("Public URL (optional, example: https://example.com/semaphore)", "", &conf.WebHost)

	askConfirmation("Enable email alerts?", false, &conf.EmailAlert)
	if conf.EmailAlert {
		askValue("Mail server host", "localhost", &conf.EmailHost)
		askValue("Mail server port", "25", &conf.EmailPort)
		askValue("Mail sender address", "semaphore@localhost", &conf.EmailSender)
	}

	askConfirmation("Enable telegram alerts?", false, &conf.TelegramAlert)
	if conf.TelegramAlert {
		askValue("Telegram bot token (you can get it from @BotFather)", "", &conf.TelegramToken)

View on GitHub (pinned to 1774ccb71a)