hasura/graphql-engine · warning
no migration files found
Error message
no migration files found
What it means
ErrNoMigrationFiles indicates that the migrations directory contains no migration files. It is returned early when an operation requires at least one migration but none were found.
Source
Thrown at cli/migrate/migrate.go:46
log "github.com/sirupsen/logrus"
"golang.org/x/term"
)
// DefaultPrefetchMigrations sets the number of migrations to pre-read
// from the source. This is helpful if the source is remote, but has little
// effect for a local source (i.e. file system).
// Please note that this setting has a major impact on the memory usage,
// since each pre-read migration is buffered in memory. See DefaultBufferSize.
var DefaultPrefetchMigrations = uint64(10)
// DefaultLockTimeout sets the max time a database driver has to acquire a lock.
var DefaultLockTimeout = 15 * time.Second
var (
ErrNoChange = errors.New("no change")
ErrNilVersion = errors.New("no migration")
ErrLocked = errors.New("database locked")
ErrNoMigrationFiles = errors.New("no migration files found")
ErrLockTimeout = errors.New("timeout: can't acquire database lock")
ErrApplied = errors.New("Version already applied in database")
ErrNotApplied = errors.New("Migration not applied in database")
ErrNoMigrationMode = errors.New("Migration mode is disabled")
ErrMigrationMode = errors.New("Migration mode is enabled")
)
const (
applyingMigrationsMessage = "Applying migrations"
)
func newProgressBar(str string, w io.Writer, pbLogs bool) *pb.ProgressBar { //nolint:unparam
// Default behaviour in non-interactive mode
if !pbLogs && !term.IsTerminal(int(os.Stdout.Fd())) {
return nil
}
// bar template configuration
str = fmt.Sprintf(`"%v: "`, str)View on GitHub (pinned to 724551b9ae)
Solutions
- Create at least one migration first (`hasura migrate create`)
- Check the migrations directory path/config
- Ensure you run the CLI from the Hasura project root
Defensive patterns
Strategy: validation
Validate before calling
entries, _ := os.ReadDir(migrationsDir)
if len(entries) == 0 { return fmt.Errorf("no migrations; create one first") } Prevention
- Check migrations directory is non-empty before running squash/apply flows
- Run CLI from the project root or pass --dir explicitly
When it happens
Trigger: Running apply/create-based flows (e.g. Squash, status) when the migrations directory is empty or the configured directory path is wrong.
Common situations: New project where no migrations were created yet, wrong --dir flag, running from a directory without a migrations/ folder.
Related errors
- unable to marshal run_sql args in %s: %w
- unable to unmarshal run_sql args in %s: %w
- creating Version table failed %s
- cannot create migration: %w
- database driver: unknown driver %v
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/a13da5bc9995537b.
Report an issue: GitHub.