{"record":{"id":"e747b9a9e0de9c40","repo":"hasura/graphql-engine","slug":"error-determining-database-kind-for-s-check-if","errorCode":null,"errorMessage":"error determining database kind for '%s', check if database exists on hasura","messagePattern":"error determining database kind for '(.+?)', check if database exists on hasura","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate_apply.go","lineNumber":223,"sourceCode":"\n\t\t\tif len(o.Source.Kind) == 0 {\n\t\t\t\t// find out the database kind by making a API call to server\n\t\t\t\t// and update ec to include the database name and kind\n\t\t\t\tsourceKind, err := metadatautil.GetSourceKind(\n\t\t\t\t\to.EC.APIClient.V1Metadata.ExportMetadata,\n\t\t\t\t\to.Source.Name,\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn herrors.E(\n\t\t\t\t\t\top,\n\t\t\t\t\t\tfmt.Errorf(\"determining database kind of '%s': %w\", o.Source.Name, err),\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tif sourceKind == nil {\n\t\t\t\t\treturn herrors.E(\n\t\t\t\t\t\top,\n\t\t\t\t\t\tfmt.Errorf(\n\t\t\t\t\t\t\t\"error determining database kind for '%s', check if database exists on hasura\",\n\t\t\t\t\t\t\to.Source.Name,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\to.Source.Kind = *sourceKind\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype errDatabaseMigrationDirectoryNotFound struct {\n\tmessage string\n}\n","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_apply.go#L205-L241","documentation":"During `hasura migrate apply` validation, metadata was exported successfully but the source named o.Source.Name was absent, so its kind is unknown. Unlike error 104 this message does not wrap errDatabaseNotFound — it cannot be matched with errors.Is on the sentinel.","triggerScenarios":"`hasura migrate apply --database-name X` where X is not present in the server's exported metadata sources list.","commonSituations":"Stale migrations directory for a removed database; typo or case mismatch in the database name; applying to the wrong environment.","solutions":["`hasura metadata export` and verify the source name exists exactly as passed","Add the database (`hasura database add X`) or fix the --database-name spelling","Delete the orphaned migrations/<name> directory if the database was intentionally removed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"hasura metadata export -o m.json && jq -e --arg n \"$DB\" '.metadata.sources[].name == $n' m.json","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert source existence in scripts before migrate apply","Delete orphan migrations dirs when removing databases"],"tags":["database-not-found","migrate-apply","metadata"],"backgroundTag":"source-database-not-found","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}