ory/hydra · error

unsupported DSN type

Error message

unsupported DSN type

What it means

When pop does not support the DSN's dialect (scheme prefix like mysql://, oracle://, typo://) and it is not a SQLite DSN, newRegistryWithoutInit fails with the generic 'unsupported DSN type' error. Hydra only supports postgres, mysql, cockroach (and sqlite when built in).

Source

Thrown at driver/registry.go:59

	consent.Registry
	jwk.Registry
	trust.Registry
	oauth2.Registry
	otelx.Provider
	x.NetworkProvider

	kratos.Provider

	fosite.Transactional
}

func newRegistryWithoutInit(c *config.DefaultProvider, l *logrusx.Logger) (*RegistrySQL, error) {
	scheme, _, _ := strings.Cut(c.DSN(), "://")
	if !pop.DialectSupported(pop.CanonicalDialect(scheme)) {
		if dbal.IsSQLite(c.DSN()) {
			return nil, errors.New("The DSN connection string looks like a SQLite connection, but SQLite support was not built into the binary. Please check if you have downloaded the correct binary or are using the correct Docker Image. Binary archives and Docker Images indicate SQLite support by appending the -sqlite suffix.")
		}
		return nil, errors.New("unsupported DSN type")
	}

	return &RegistrySQL{
		l:           l,
		conf:        c,
		initialPing: defaultInitialPing,
	}, nil
}

func callRegistry(ctx context.Context, r *RegistrySQL) {
	r.ClientValidator()
	r.ClientManager()
	r.ClientHasher()
	r.ConsentManager()
	r.ConsentStrategy()
	r.KeyManager()
	r.KeyCipher()
	r.FlowCipher()

View on GitHub (pinned to 4174065ffb)

Solutions

  1. Set ORY_HYDRA_DSN / config dsn to postgres://, mysql://, or cockroach:// URL
  2. Fix typos in the DSN scheme and ensure the scheme prefix is present
  3. If you intended SQLite, use a binary/image built with sqlite support (see the sqlite variant error)

Example fix

// before
-e DSN=mongodb://localhost:27017/hydra
// after
-e DSN=postgres://user:pass@host:5432/hydra?sslmode=disable
Defensive patterns

Strategy: validation

Validate before calling

var supported = map[string]bool{"postgres": true, "postgresql": true, "mysql": true, "cockroach": true, "sqlite": true}
scheme, _, _ := strings.Cut(dsn, "://")
if !supported[scheme] {
    return fmt.Errorf("unsupported DSN scheme %q; use postgres, mysql or cockroach", scheme)
}

Prevention

When it happens

Trigger: Calling driver.New with a DSN whose scheme is not a pop-supported dialect — e.g. `mongodb://...`, `oracle://...`, an empty DSN string, or a typo like `postgresq://`.

Common situations: Using an unsupported database behind Hydra; typos in the DSN scheme; DSN environment variable empty or missing its scheme prefix; copy-paste from another app.

Related errors


AI-assisted analysis of ory/hydra@4174065ffb (2026-09-03). Data as JSON: /api/errors/38f2db5b1779b8a4. Report an issue: GitHub.