hasura/graphql-engine · error

determining database kind of '%s': %w

Error message

determining database kind of '%s': %w

What it means

While validating source info, the CLI calls migrate.GetSourceKind (via ec.APIClient.V1Metadata.ExportMetadata) to determine the database kind from server metadata. This error wraps whatever went wrong during that metadata export — HTTP failure, auth error, or malformed response.

Source

Thrown at cli/commands/migrate.go:276

		!cmd.Flags().Changed("database-name") {
		return errors.E(op, errDatabaseNameNotSet)
	}

	return nil
}

func validateSourceInfo(ec *cli.ExecutionContext) error {
	var op errors.Op = "commands.validateSourceInfo"
	// find out the database kind by making a API call to server
	// and update ec to include the database name and kind
	sourceKind, err := metadatautil.GetSourceKind(
		ec.APIClient.V1Metadata.ExportMetadata,
		ec.Source.Name,
	)
	if err != nil {
		return errors.E(
			op,
			fmt.Errorf("determining database kind of '%s': %w", ec.Source.Name, err),
		)
	}

	if sourceKind == nil {
		return errors.E(
			op,
			fmt.Errorf(
				"%w: error determining database kind for '%s', check if database exists on hasura",
				errDatabaseNotFound,
				ec.Source.Name,
			),
		)
	}

	ec.Source.Kind = *sourceKind

	return nil
}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Verify connectivity: curl $ENDPOINT/v1metadata with x-hasura-admin-secret
  2. Ensure --admin-secret / HASURA_GRAPHQL_ADMIN_SECRET matches the server
  3. Retry after the server is healthy; check server logs for 5xx during export_metadata
Defensive patterns

Strategy: retry

Validate before calling

curl -sf -H "x-hasura-admin-secret: $SECRET" -d '{"type":"export_metadata"}' "$ENDPOINT/v1metadata" >/dev/null

Try / catch

if err != nil { var netErr net.Error; if errors.As(err, &netErr) { /* backoff and retry */ } }

Prevention

When it happens

Trigger: Any `hasura migrate` command (config v3) where exporting metadata from the server fails: bad endpoint, admin secret, 5xx from server, or JSON unmarshal issues.

Common situations: Server not running, wrong HASURA_GRAPHQL_ADMIN_SECRET env, network/VPN issues, or proxy stripping the request.

Related errors


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