{"record":{"id":"c5b1dc3f82603956","repo":"hasura/graphql-engine","slug":"cannot-fetch-migrate-status-w","errorCode":null,"errorMessage":"cannot fetch migrate status: %w","messagePattern":"cannot fetch migrate status: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate_status.go","lineNumber":130,"sourceCode":"\t}\n)\n\nfunc (o *MigrateStatusOptions) RunOnSource() (*migrate.Status, error) {\n\tvar op errors.Op = \"commands.MigrateStatusOptions.RunOnSource\"\n\n\tif o.EC.Config.Version <= cli.V2 {\n\t\to.Source.Name = \"\"\n\t\to.Source.Kind = hasura.SourceKindPG\n\t}\n\n\tmigrateDrv, err := migrate.NewMigrate(o.EC, true, o.Source.Name, o.Source.Kind)\n\tif err != nil {\n\t\treturn nil, errors.E(op, err)\n\t}\n\n\tstatus, err := executeStatus(migrateDrv)\n\tif err != nil {\n\t\treturn nil, errors.E(op, fmt.Errorf(\"cannot fetch migrate status: %w\", err))\n\t}\n\n\treturn status, nil\n}\n\nfunc printStatus(statusOpts StatusOptions) *bytes.Buffer {\n\tout := new(tabwriter.Writer)\n\tbuf := &bytes.Buffer{}\n\tout.Init(buf, 0, 8, 2, ' ', 0)\n\tw := util.NewPrefixWriter(out)\n\n\tfor source, status := range statusOpts {\n\t\tif source.Name != \"\" {\n\t\t\tw.Write(util.LEVEL_0, fmt.Sprintf(\"\\nDatabase: %s\\n\", source.Name))\n\t\t}\n\n\t\tw.Write(util.LEVEL_0, \"VERSION\\tNAME\\tSOURCE STATUS\\tDATABASE STATUS\\n\")\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_status.go#L112-L148","documentation":"RunOnSource wraps the result of executeStatus: after successfully creating the migrate driver, querying migration status (hasuractl status) against the database failed. This is a database-side or migrations-catalog problem, not metadata export.","triggerScenarios":"Calling RunOnSource (migrate status / status APIs) where executeStatus errors: cannot query the hdb_catalog schema migrations state, DB connection dropped mid-query, or an unexpected response from the status command.","commonSituations":"Database restarted/failover during the query, permissions revoked on hdb_catalog, migrations state table corrupted, or proxy timeouts killing long status queries.","solutions":["Re-run the status command (transient connection drops are common)","Verify the CLI's DB user can read hdb_catalog (or information_schema) on the target database","Check database logs for the failed query around the time of the error","If state is corrupted, use 'hasura migrate apply' to reconcile and retry status"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure the target DB accepts queries before status\ndb, err := sql.Open(\"pgx\", dbURL)\nif err != nil { return err }\ndefer db.Close()\nif err := db.Ping(); err != nil { return fmt.Errorf(\"db not ready: %w\", err) }","typeGuard":null,"tryCatchPattern":"Retry with backoff on this error (transient drops/failovers are common); after N retries, unwrap and inspect whether the cause is permissions on hdb_catalog vs connectivity.","preventionTips":["Use connection pools with keepalives for long status queries","Grant the CLI user read on hdb_catalog","Retry status once after DB failover events"],"tags":["hasura","migrate-status","database"],"backgroundTag":"database-status-check-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}