hasura/graphql-engine · error

cannot create migrations directory: %w

Error message

cannot create migrations directory: %w

What it means

A generic error signalling that some feature used in the metadata is not supported (yet) by this resolver/version. The message string carries the specifics of which feature was rejected.

Source

Thrown at cli/cli.go:750

	ec.Config.HTTPClient.SetHeaders(ec.requestHeaders)

	// this populates the ec.Config.ServerConfig.HasuraServerInternalConfig
	err = ec.Config.GetHasuraInternalServerConfig(httpClient)
	if err != nil {
		// If config API is not enabled log it and don't fail
		ec.Logger.Debugf(
			"cannot get config information from server, this might be because config API is not enabled: %v",
			err,
		)
	}

	// set name of migration directory
	ec.MigrationDir = filepath.Join(ec.ExecutionDirectory, ec.Config.MigrationsDirectory)
	if _, err := os.Stat(ec.MigrationDir); stderrors.Is(err, fs.ErrNotExist) {
		err = os.MkdirAll(ec.MigrationDir, os.ModePerm)
		if err != nil {
			return errors.E(op, fmt.Errorf("cannot create migrations directory: %w", err))
		}
	}

	ec.SeedsDirectory = filepath.Join(ec.ExecutionDirectory, ec.Config.SeedsDirectory)
	if _, err := os.Stat(ec.SeedsDirectory); stderrors.Is(err, fs.ErrNotExist) {
		err = os.MkdirAll(ec.SeedsDirectory, os.ModePerm)
		if err != nil {
			return errors.E(op, fmt.Errorf("cannot create seeds directory: %w", err))
		}
	}

	if ec.Config.Version >= V2 && ec.Config.MetadataDirectory != "" {
		if len(ec.Config.MetadataFile) > 0 {
			ec.MetadataFile = filepath.Join(ec.ExecutionDirectory, ec.Config.MetadataFile)
			if _, err := os.Stat(ec.MetadataFile); stderrors.Is(err, fs.ErrNotExist) {
				err := os.WriteFile(ec.MetadataFile, []byte(""), os.ModePerm)
				if err != nil {
					return errors.E(op, err)

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Read the message text to identify the unsupported feature and remove or replace it
  2. Upgrade the engine/resolver to a version that supports the feature
  3. Check feature flags that gate the feature
Defensive patterns

Strategy: fallback

Try / catch

// treat as a capability probe: catch and degrade
match resolve_metadata(&md) {
    Err(e) if matches!(e, ResolveError::UnsupportedFeature { .. }) => fallback_metadata_without_feature(&md),
    r => r,
}

Prevention

When it happens

Trigger: Using metadata constructs that are parsed but not implemented by the current resolver version (e.g. experimental syntax, newer metadata features on an older build), which the resolver detects and reports via UnsupportedFeature.

Common situations: Upgrading metadata to a newer format while the engine/resolver is older; enabling beta features without the corresponding feature flag; using constructs documented for a different edition.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/e9c6299a782033c8. Report an issue: GitHub.