{"record":{"id":"14a98ad66ed26463","repo":"hasura/graphql-engine","slug":"determining-database-kind-of-s-w-14a98a","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_apply.go","lineNumber":216,"sourceCode":"\t\t\t)\n\t\t}\n\n\t\tif !o.EC.AllDatabases {\n\t\t\tif len(o.Source.Name) == 0 {\n\t\t\t\treturn herrors.E(op, \"empty database name\")\n\t\t\t}\n\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","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/migrate_apply.go#L198-L234","documentation":"In `hasura migrate apply` Validate, the CLI exports server metadata to determine the kind of the target source (o.Source.Name). This wraps failures of that ExportMetadata call: network, auth, or response parsing problems.","triggerScenarios":"`hasura migrate apply` (or library callers of Validate/Execute/Apply) where the v1metadata export_metadata request fails — server down, 401, timeout, invalid JSON.","commonSituations":"CI runs against a server whose admin secret rotated; local dev server restarting; wrong endpoint in config.yaml.","solutions":["Check endpoint/admin secret in config.yaml and env","Confirm the server responds: curl -H 'x-hasura-admin-secret: ...' $ENDPOINT/healthz","Re-run once transient network issues are resolved"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"curl -sf -H \"x-hasura-admin-secret: $SECRET\" \"$ENDPOINT/v1/metadata\" -d '{\"type\":\"export_metadata\",\"args\":{}}' >/dev/null","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"determining database kind\") { /* verify endpoint/secret, retry once */ }","preventionTips":["Pre-flight health check the server before migrate apply","Rotate admin secrets via config, not hardcoded flags"],"tags":["migrate-apply","metadata-export","network"],"backgroundTag":"metadata-export-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}