{"record":{"id":"27439b5dcf6cff78","repo":"hasura/graphql-engine","slug":"w-error-determining-database-kind-for-s-chec","errorCode":null,"errorMessage":"%w: error determining database kind for '%s', check if database exists on hasura","messagePattern":"%w: error determining database kind for '(.+?)', check if database exists on hasura","errorType":"error_code","errorClass":"errDatabaseNotFound","httpStatus":null,"severity":"error","filePath":"cli/commands/migrate.go","lineNumber":283,"sourceCode":"func validateSourceInfo(ec *cli.ExecutionContext) error {\n\tvar op errors.Op = \"commands.validateSourceInfo\"\n\t// find out the database kind by making a API call to server\n\t// and update ec to include the database name and kind\n\tsourceKind, err := metadatautil.GetSourceKind(\n\t\tec.APIClient.V1Metadata.ExportMetadata,\n\t\tec.Source.Name,\n\t)\n\tif err != nil {\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\"determining database kind of '%s': %w\", ec.Source.Name, err),\n\t\t)\n\t}\n\n\tif sourceKind == nil {\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\n\t\t\t\t\"%w: error determining database kind for '%s', check if database exists on hasura\",\n\t\t\t\terrDatabaseNotFound,\n\t\t\t\tec.Source.Name,\n\t\t\t),\n\t\t)\n\t}\n\n\tec.Source.Kind = *sourceKind\n\n\treturn nil\n}\n\nfunc databaseChooser(ec *cli.ExecutionContext) error {\n\tvar op errors.Op = \"commands.databaseChooser\"\n\t// prompt UI for choosing database if source name is not set\n\tif ec.Source.Name == \"\" {\n\t\tdatabaseName, err := metadatautil.DatabaseChooserUI(ec.APIClient.V1Metadata.ExportMetadata)\n\t\tif err != nil {","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate.go#L265-L301","documentation":"The metadata export succeeded but the requested source name was not found in the returned metadata (sourceKind == nil), so its kind cannot be determined. It wraps the sentinel errDatabaseNotFound, making it detectable via errors.Is.","triggerScenarios":"Running migrate commands with --database-name <name> where <name> is not a source in the server's metadata; or the migrations/<name> directory exists locally but the source was removed server-side.","commonSituations":"Renaming/removing a database in the console but keeping stale local migrations; typo in --database-name; pointing the CLI at a different environment/project than the one where the source was added.","solutions":["Run `hasura metadata export` and check sources[].name to confirm the exact source name","Re-add the source (`hasura database add` or metadata apply) if it should exist","Use the correct --database-name matching metadata exactly (case-sensitive)","Point --endpoint at the environment that actually has this database"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"hasura metadata export -o m.json\njq -e --arg n \"$DB\" '.metadata.sources[] | select(.name==$n)' m.json >/dev/null || echo \"source missing\"","typeGuard":null,"tryCatchPattern":"if errors.Is(err, migrate.ErrDatabaseNotFound) { /* re-add source or fix name */ }","preventionTips":["Always list sources via metadata export before --database-name runs","Keep local migrations directories in sync with server-tracked sources"],"tags":["database-not-found","metadata","migrations"],"backgroundTag":"source-database-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}