hasura/graphql-engine · error

determining database kind of '%s': %w

Error message

determining database kind of '%s': %w

What it means

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.

Source

Thrown at cli/commands/migrate_apply.go:216

			)
		}

		if !o.EC.AllDatabases {
			if len(o.Source.Name) == 0 {
				return herrors.E(op, "empty database name")
			}

			if len(o.Source.Kind) == 0 {
				// find out the database kind by making a API call to server
				// and update ec to include the database name and kind
				sourceKind, err := metadatautil.GetSourceKind(
					o.EC.APIClient.V1Metadata.ExportMetadata,
					o.Source.Name,
				)
				if err != nil {
					return herrors.E(
						op,
						fmt.Errorf("determining database kind of '%s': %w", o.Source.Name, err),
					)
				}

				if sourceKind == nil {
					return herrors.E(
						op,
						fmt.Errorf(
							"error determining database kind for '%s', check if database exists on hasura",
							o.Source.Name,
						),
					)
				}

				o.Source.Kind = *sourceKind
			}
		}
	}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Check endpoint/admin secret in config.yaml and env
  2. Confirm the server responds: curl -H 'x-hasura-admin-secret: ...' $ENDPOINT/healthz
  3. Re-run once transient network issues are resolved
Defensive patterns

Strategy: retry

Validate before calling

curl -sf -H "x-hasura-admin-secret: $SECRET" "$ENDPOINT/v1/metadata" -d '{"type":"export_metadata","args":{}}' >/dev/null

Try / catch

if strings.Contains(err.Error(), "determining database kind") { /* verify endpoint/secret, retry once */ }

Prevention

When it happens

Trigger: `hasura migrate apply` (or library callers of Validate/Execute/Apply) where the v1metadata export_metadata request fails — server down, 401, timeout, invalid JSON.

Common situations: CI runs against a server whose admin secret rotated; local dev server restarting; wrong endpoint in config.yaml.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/14a98ad66ed26463. Report an issue: GitHub.