ory/hydra · warning
unsupported dialect
Error message
unsupported dialect
What it means
errUnsupportedMigrationDialect is the sentinel error returned by parseMigrationFilename when a migration file's filename encodes a database dialect that is not supported. Callers use errors.Is to distinguish 'unknown dialect' (skippable, non-fatal) from genuine filename parse errors.
Source
Thrown at oryx/popx/match.go:17
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package popx
import (
"regexp"
"strings"
"github.com/pkg/errors"
"github.com/ory/pop/v6"
"github.com/ory/x/dbal"
)
var errUnsupportedMigrationDialect = errors.New("unsupported dialect")
var MigrationFileRegexp = regexp.MustCompile(
`^(\d+)_([^.]+)(\.[a-z0-9]+)?(\.autocommit)?\.(up|down)\.(sql)$`,
)
const (
// Human-readable constants for the regex capture groups
versionIdx = iota + 1
nameIdx
dbTypeIdx
autocommitIdx
directionIdx
typeIdx
)
// match holds the information parsed from a migration filename.
type match struct {
Version stringView on GitHub (pinned to 4174065ffb)
Solutions
- Verify the migration filename matches MigrationFileRegexp and uses a supported dialect (e.g. .postgres., .sqlite., .mysql.)
- Only ship migration files relevant to the databases your binary supports, or gate them per deployment
- Register/enable the driver so pop.DialectSupported(dbType) returns true if the dialect should be valid
- Confirm dbal driver naming matches the dialect string used in the migration filename
Defensive patterns
Strategy: type-guard
Validate before calling
m := MigrationFileRegexp.FindStringSubmatch(filename)
if m == nil {
// not a migration file at all
}
if dialect := extractDialect(filename); dialect != "" && !pop.DialectSupported(dialect) {
// dialect unsupported: skip like migration_box does
} Type guard
func isUnsupportedDialectErr(err error) bool {
return errors.Is(err, errUnsupportedMigrationDialect)
} Try / catch
details, err := parseMigrationFilename(info.Name())
if err != nil {
if errors.Is(err, errUnsupportedMigrationDialect) {
logger.Debugf("skipping %s: %s", info.Name(), err)
return nil
}
return err
} Prevention
- Only ship migration files for dialects your binary supports
- Name migration files strictly per MigrationFileRegexp with a recognized dialect
- Test migration loading against your migrations directory in CI
When it happens
Trigger: Scanning a migrations directory where a file name carries a dialect suffix or pattern that maps to a dbType for which pop.DialectSupported returns false (and which is not YugabyteDB), as checked in match.go:75; also surfaces when migration_box.go iterates files and calls parseMigrationFilename on files with an unrecognized dialect component.
Common situations: Migration folders shared across projects containing mysql-, postgres-, or sqlite-specific migration files being loaded by a binary built for a different dialect; adding a new dialect's migrations before the driver is registered; typos in the dialect portion of the filename.
Related errors
- %s
- problem checking for migration version %s
- invalid DSN: missing scheme separator
- invalid DSN: empty scheme
- database error on committing or rolling back transaction: %w
AI-assisted analysis of ory/hydra@4174065ffb (2026-09-03).
Data as JSON: /api/errors/e428edbd7f1a4e0d.
Report an issue: GitHub.