hasura/graphql-engine · error

cannot determine name of database for which current migratio

Error message

cannot determine name of database for which current migrations / seed belong to, found 0 connected databases on hasura %v

What it means

Thrown by scripts.UpdateProjectV3 when the CLI needs to infer which database the existing flat migrations/seed belong to, but the server reports zero connected databases (other than possibly the default). With V3, migrations live under migrations/<dbname>/, so a source database must be identifiable to move them into.

Source

Thrown at cli/internal/scripts/update-project-v3.go:121

	if err != nil {
		return errors.E(op, err)
	}

	if len(targetDatabase) == 0 {
		if len(sources) == 1 && sources[0] == "default" {
			targetDatabase = sources[0]
		} else if len(sources) > 0 {
			targetDatabase, err = util.GetSelectPrompt(
				"what database does this current migrations / seeds belong to?",
				sources,
			)
			if err != nil {
				return errors.E(op, err)
			}
		} else {
			return errors.E(
				op,
				fmt.Errorf(
					"cannot determine name of database for which current migrations / seed belong to, found 0 connected databases on hasura %v",
					sources,
				),
			)
		}
	}

	opts.EC.Spinner.Start()
	opts.EC.Spin("updating project... ")

	defer opts.EC.Spinner.Stop()

	if len(sources) >= 1 {
		opts.EC.Logger.Debug("start: copying state from hdb_catalog.schema_migrations")
		opts.EC.Spin("Moving state from hdb_catalog.schema_migrations ")

		err := CopyState(opts.EC, targetDatabase, targetDatabase)
		if err != nil {

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Add (or restore) at least one database source on the server (e.g. hasura msr... or via console: Data -> Connect Database) and retry
  2. Verify you're pointed at the correct environment/endpoint that actually has your sources
  3. If the project genuinely has no database, consider starting from a fresh V3 project instead of upgrading
Defensive patterns

Strategy: validation

Validate before calling

// verify at least one database source exists before upgrade:
sources, err := ec.APIClient.V1Metadata.GetSources() // or list sources via API
if err != nil { return err }
if countDatabaseSources(sources) == 0 {
	return errors.New("connect a database source before upgrading to V3")
}

Prevention

When it happens

Trigger: Running update-project-v3 against a server whose source list contains no usable database sources — e.g. all sources were removed, only an MSSQL/other source type that isn't eligible, or the sources query returned empty.

Common situations: Fresh server with metadata but no data sources attached, sources deleted before migration, or connecting to the wrong (empty) environment.

Related errors


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