ory/hydra · error

invalid database type %q, expected "all" because fizz is dat

Error message

invalid database type %q, expected "all" because fizz is database type independent

What it means

Fizz migrations are dialect-independent, so they must be named with the "all" database type. parseMigrationFilename throws this error (oryx/popx/match.go:79) when the migration type segment is "fizz" but the filename declares a specific dialect, because fizz cannot be filtered by dialect.

Source

Thrown at oryx/popx/match.go:80

	} else {
		dbType = strings.TrimPrefix(m[dbTypeIdx], ".")
		// The commercial package registers this dialect from init(), but
		// migration boxes can be constructed before that package enters the
		// import graph. Canonicalize both accepted spellings independently of
		// registration so migration selection is deterministic in every build.
		switch dbType {
		case dbal.DriverYugabyteDB, "yugabytedb":
			dbType = dbal.DriverYugabyteDB
		default:
			dbType = pop.CanonicalDialect(dbType)
		}
		if dbType != dbal.DriverYugabyteDB && !pop.DialectSupported(dbType) {
			return nil, errors.Wrapf(errUnsupportedMigrationDialect, "%s", dbType)
		}
	}

	if m[typeIdx] == "fizz" && dbType != "all" {
		return nil, errors.Errorf("invalid database type %q, expected \"all\" because fizz is database type independent", dbType)
	}

	if m[autocommitIdx] == ".autocommit" {
		autocommit = true
	} else if m[autocommitIdx] != "" {
		return nil, errors.Errorf("invalid autocommit flag %q", m[autocommitIdx])
	}

	return &match{
		Version:    m[versionIdx],
		Name:       m[nameIdx],
		DBType:     dbType,
		Autocommit: autocommit,
		Direction:  m[directionIdx],
		Type:       m[typeIdx],
	}, nil
}

View on GitHub (pinned to 4174065ffb)

Solutions

  1. Remove the dialect segment so fizz migrations use the "all" database type, e.g. 20210101000000_name.fizz.up.sql
  2. If the migration is dialect-specific, rewrite the content as SQL and keep the dialect segment with type sql instead of fizz

Example fix

// before
20210101000000_create_table.postgres.fizz.up.fizz  (fizz with .postgres. segment)
// after
20210101000000_create_table.fizz.up.fizz
Defensive patterns

Strategy: validation

Validate before calling

re := regexp.MustCompile(`^(\d+)_([^.]+)(\.[a-z0-9]+)?(\.autocommit)?\.(up|down)\.(sql)$`)
m := re.FindStringSubmatch(filename)
if m != nil && strings.HasSuffix(filename, ".fizz") && m[3] != "" && m[3] != ".autocommit" {
    return fmt.Errorf("fizz migration %q must not declare a dialect", filename)
}

Try / catch

if _, err := parseMigrationFilename(name); err != nil {
    if strings.Contains(err.Error(), "fizz is database type independent") {
        return fmt.Errorf("fix filename %s: fizz migrations need no dialect segment", name)
    }
    return err
}

Prevention

When it happens

Trigger: A filename like 20210101000000_name.postgres.fizz.up.fizz or otherwise with type=fizz while the dialect segment is a concrete dialect (e.g. .postgres.) instead of empty/all.

Common situations: Hand-edited migration filenames; converting a fizz migration by adding a dialect segment; tooling that generates filenames with wrong group ordering.

Related errors


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