{"record":{"id":"6fe55afe41759634","repo":"hasura/graphql-engine","slug":"determining-database-kind-of-s-w","errorCode":null,"errorMessage":"determining database kind of '%s': %w","messagePattern":"determining database kind of '(.+?)': %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/migrate.go","lineNumber":276,"sourceCode":"\t\t!cmd.Flags().Changed(\"database-name\") {\n\t\treturn errors.E(op, errDatabaseNameNotSet)\n\t}\n\n\treturn nil\n}\n\nfunc 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}","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate.go#L258-L294","documentation":"While validating source info, the CLI calls migrate.GetSourceKind (via ec.APIClient.V1Metadata.ExportMetadata) to determine the database kind from server metadata. This error wraps whatever went wrong during that metadata export — HTTP failure, auth error, or malformed response.","triggerScenarios":"Any `hasura migrate` command (config v3) where exporting metadata from the server fails: bad endpoint, admin secret, 5xx from server, or JSON unmarshal issues.","commonSituations":"Server not running, wrong HASURA_GRAPHQL_ADMIN_SECRET env, network/VPN issues, or proxy stripping the request.","solutions":["Verify connectivity: curl $ENDPOINT/v1metadata with x-hasura-admin-secret","Ensure --admin-secret / HASURA_GRAPHQL_ADMIN_SECRET matches the server","Retry after the server is healthy; check server logs for 5xx during export_metadata"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"curl -sf -H \"x-hasura-admin-secret: $SECRET\" -d '{\"type\":\"export_metadata\"}' \"$ENDPOINT/v1metadata\" >/dev/null","typeGuard":null,"tryCatchPattern":"if err != nil { var netErr net.Error; if errors.As(err, &netErr) { /* backoff and retry */ } }","preventionTips":["Wrap migrate calls in retry with backoff for transient network failures","Verify admin secret before running migrate in CI"],"tags":["metadata-export","network","hasura-cli"],"backgroundTag":"metadata-export-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}