{"record":{"id":"e44ecdba045c28a9","repo":"hasura/graphql-engine","slug":"error-getting-status-for-database-s-w","errorCode":null,"errorMessage":"error getting status for database '%s': %w","messagePattern":"error getting status for database '(.+?)': %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate_status.go","lineNumber":81,"sourceCode":"\to.EC.Spin(\"Fetching migration status...\")\n\tdefer o.EC.Spinner.Stop()\n\n\tif ec.AllDatabases {\n\t\tsourcesAndKind, err := metadatautil.GetSourcesAndKind(\n\t\t\to.EC.APIClient.V1Metadata.ExportMetadata,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"got error while getting the sources list : %w\", err))\n\t\t}\n\n\t\tfor _, source := range sourcesAndKind {\n\t\t\to.Source = cli.Source(source)\n\n\t\t\tstatus, err := o.RunOnSource()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.E(\n\t\t\t\t\top,\n\t\t\t\t\tfmt.Errorf(\"error getting status for database '%s': %w\", o.Source.Name, err),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\to.StatusOpts[o.Source] = status\n\t\t}\n\n\t\treturn nil\n\t}\n\n\to.Source = ec.Source\n\n\tstatus, err := o.RunOnSource()\n\tif err != nil {\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\"error getting status for database '%s': %w\", o.Source.Name, err),\n\t\t)\n\t}","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_status.go#L63-L99","documentation":"Thrown by migrate status Run in --all-databases mode when RunOnSource returns an error for a specific source (database) listed in metadata. The underlying error typically comes from building the migrate driver or executing status against that source.","triggerScenarios":"Running 'hasura migrate status --all-databases' where one of the connected sources has a bad connection string, unreachable database, unsupported database kind, or mismatched migrations state.","commonSituations":"A source in metadata pointing to a database that is down or credentials rotated; a source added with a wrong DB URL; network egress blocked from server to database.","solutions":["Check the specific source's database connectivity (psql/connect with its connection string)","Fix or remove the broken source in Hasura metadata and re-run status","Run 'hasura migrate status --database <name>' on the failing source for a detailed error","Verify the database kind is supported by migrate (e.g. postgres)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight each source's DB connectivity before status\nfor _, s := range sources {\n    db, err := sql.Open(\"pgx\", s.DatabaseURL)\n    if err == nil { err = db.Ping() }\n    if err != nil { log.Warnf(\"source %s unhealthy: %v\", s.Name, err) }\n    db.Close()\n}","typeGuard":null,"tryCatchPattern":"Per-source try/catch: log and continue with healthy sources, collect failing source names, and exit non-zero only if all fail — the loop context (%s = source name) tells you which to retry.","preventionTips":["Monitor connectivity to every source in metadata","Remove decommissioned sources from metadata","Run per-database status in CI to isolate failures"],"tags":["hasura","migrate-status","database-connection","all-databases"],"backgroundTag":"database-status-check-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}