hasura/graphql-engine · error
error determining database kind for '%s', check if database
Error message
error determining database kind for '%s', check if database exists on hasura
What it means
During `hasura migrate apply` validation, metadata was exported successfully but the source named o.Source.Name was absent, so its kind is unknown. Unlike error 104 this message does not wrap errDatabaseNotFound — it cannot be matched with errors.Is on the sentinel.
Source
Thrown at cli/commands/migrate_apply.go:223
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
}
}
}
return nil
}
type errDatabaseMigrationDirectoryNotFound struct {
message string
}
View on GitHub (pinned to 724551b9ae)
Solutions
- `hasura metadata export` and verify the source name exists exactly as passed
- Add the database (`hasura database add X`) or fix the --database-name spelling
- Delete the orphaned migrations/<name> directory if the database was intentionally removed
Defensive patterns
Strategy: validation
Validate before calling
hasura metadata export -o m.json && jq -e --arg n "$DB" '.metadata.sources[].name == $n' m.json
Prevention
- Assert source existence in scripts before migrate apply
- Delete orphan migrations dirs when removing databases
When it happens
Trigger: `hasura migrate apply --database-name X` where X is not present in the server's exported metadata sources list.
Common situations: Stale migrations directory for a removed database; typo or case mismatch in the database name; applying to the wrong environment.
Related errors
- %w: error determining database kind for '%s', check if datab
- error fetching config from server: %w
- error fetching server config: %v
- cannot get absolute path: %w
- error while creating http client with TLS configuration %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/e747b9a9e0de9c40.
Report an issue: GitHub.