ory/hydra · error

error processing %s

Error message

error processing %s

What it means

During migration execution (MigrationBox.Run/Exec), each migration's content is prepared via mb.migrationContent. If content preparation fails, the error is wrapped with "error processing <path>" (oryx/popx/migration_box.go:196) so the developer knows which migration file could not be processed. The underlying error (parse failure, fizz template error, etc.) is preserved in the wrap chain.

Source

Thrown at oryx/popx/migration_box.go:196

}

// NewMigrationBox creates a new migration box.
func NewMigrationBox(dir fs.FS, c *pop.Connection, l *logrusx.Logger, opts ...MigrationBoxOption) (*MigrationBox, error) {
	mb := &MigrationBox{
		c:                c,
		l:                l,
		migrationContent: ParameterizedMigrationContent(nil),
	}

	for _, o := range opts {
		o(mb)
	}

	txRunner := func(b []byte) func(Migration, *pop.Connection) error {
		return func(mf Migration, c *pop.Connection) error {
			content, err := mb.migrationContent(mf, c, b, true)
			if err != nil {
				return errors.Wrapf(err, "error processing %s", mf.Path)
			}
			if isMigrationEmpty(content) {
				l.WithField("migration", mf.Path).Trace("This is usually ok - ignoring migration because content is empty. This is ok!")
				return nil
			}

			var q queryExecutor = c.Store.SQLDB()
			if c.TX != nil {
				q = c.TX
			}

			if _, err = q.Exec(content); err != nil {
				return errors.Wrapf(err, "error executing %s, sql: %s", mf.Path, content)
			}
			return nil
		}
	}

View on GitHub (pinned to 4174065ffb)

Solutions

  1. Read the wrapped cause in the error chain to identify the real parse/compile failure in the migration at the reported path
  2. Fix or remove the broken migration file and rebuild/redeploy
  3. Verify the migration content is valid for the connected dialect

Example fix

// before (malformed fizz template)
CREATE TABLE %%{{ users }}; SELECT FROM
// after (valid SQL)
CREATE TABLE users (id serial primary key);
Defensive patterns

Strategy: try-catch

Validate before calling

// validate migration content parses before running migrations
content, err := mb.MigrationContent(mf, conn, raw, true)
if err != nil { return fmt.Errorf("migration %s has invalid content: %w", mf.Path, err) }

Try / catch

err := mb.Exec(ctx, conn)
if err != nil {
    // the wrap chain names the file: 'error processing <path>' plus the cause
    log.Printf("migration run failed: %+v", err)
    return err
}

Prevention

When it happens

Trigger: mb.migrationContent(mf, c, b, true) returns an error for a migration file while running migrations from a directory — e.g. invalid SQL/fizz template content that cannot be compiled for the connection's dialect.

Common situations: Corrupted or malformed migration file content embedded in the binary; fizz template syntax errors; a migration written for a dialect incompatible with the connected database.

Related errors


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