goharbor/harbor · error

invalid database

Error message

invalid database: %s

What it means

Configuration validation in getDatabase: the switch over database.Type only accepts '' or 'postgresql'; any other configured type (e.g. a leftover mysql setting) produces this sentinel error at startup, before any connection is attempted. A guard against unsupported configuration input.

Solutions

  1. Set the database type in harbor.yml to 'postgresql' (or leave it empty for the default)
  2. Remove legacy mysql database configuration from harbor.yml
  3. Re-run install/prepare after fixing the configuration
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/common/dao/base.go:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/4e3c8c966f951518. Report an issue: GitHub.

Appendix: source

Thrown at src/common/dao/base.go:92

func getDatabase(database *models.Database) (db Database, err error) {
	switch database.Type {
	case "", "postgresql":
		db = NewPGSQL(
			database.PostGreSQL.Host,
			strconv.Itoa(database.PostGreSQL.Port),
			database.PostGreSQL.Username,
			database.PostGreSQL.Password,
			database.PostGreSQL.Database,
			database.PostGreSQL.SSLMode,
			database.PostGreSQL.MaxIdleConns,
			database.PostGreSQL.MaxOpenConns,
			database.PostGreSQL.ConnMaxLifetime,
			database.PostGreSQL.ConnMaxIdleTime,
		)
	default:
		err = fmt.Errorf("invalid database: %s", database.Type)
	}
	return
}

View on GitHub (pinned to 7b2fd08cc5)