{"record":{"id":"d805f3e8404257a4","repo":"hasura/graphql-engine","slug":"cannot-fetch-schema-dump-w","errorCode":null,"errorMessage":"cannot fetch schema dump: %w","messagePattern":"cannot fetch schema dump: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate_create.go","lineNumber":247,"sourceCode":"\t}\n\n\tif o.sqlFile != \"\" {\n\t\t// sql-file flag is set\n\t\terr := createOptions.SetSQLUpFromFile(o.sqlFile)\n\t\tif err != nil {\n\t\t\treturn 0, herrors.E(op, fmt.Errorf(\"cannot set sql file: %w\", err))\n\t\t}\n\t}\n\n\tif o.sqlServer {\n\t\tdata, err := migrateDrv.ExportSchemaDump(\n\t\t\to.includeSchemas,\n\t\t\to.excludeSchemas,\n\t\t\to.Source.Name,\n\t\t\to.Source.Kind,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn 0, herrors.E(op, fmt.Errorf(\"cannot fetch schema dump: %w\", err))\n\t\t}\n\n\t\terr = createOptions.SetSQLUp(string(data))\n\t\tif err != nil {\n\t\t\treturn 0, herrors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"while writing data from server into the up.sql file: %w\", err),\n\t\t\t)\n\t\t}\n\t}\n\n\t// create pure sql based migrations here\n\tif o.upSQLChanged {\n\t\terr = createOptions.SetSQLUp(o.upSQL)\n\t\tif err != nil {\n\t\t\treturn 0, herrors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"up migration with SQL string could not be created: %w\", err),","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_create.go#L229-L265","documentation":"With --sql-server, migrate create asks the server for a schema dump via migrateDrv.ExportSchemaDump (driven by include/exclude schemas). This wraps failures of that server-side export: unsupported kind, DB connection error from the server, or metadata/API error.","triggerScenarios":"`hasura migrate create X --sql-server --database-name N` when the server cannot connect to the underlying database, or the source kind doesn't support schema dumps.","commonSituations":"Database credentials rotated on the server, network egress from server to DB blocked, using --sql-server against non-postgres sources in older versions.","solutions":["Check the server's DB connection (run a query via console/hasura db execute)","Verify include/exclude schema names are valid for the kind","Upgrade CLI/server for broader dump support; fall back to --sql-file with a manual dump"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"hasura db execute --database-name \"$DB\" --sql 'select 1' <<< '' >/dev/null 2>&1 || echo \"db unreachable from server\"","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"cannot fetch schema dump\") { /* check server->DB connectivity, retry */ }","preventionTips":["Monitor server-to-database connectivity","Keep DB credentials current in server env"],"tags":["migrate-create","schema-dump","server-database-connection"],"backgroundTag":"schema-dump-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}