hasura/graphql-engine · error
exporting seed data: %w
Error message
exporting seed data: %w
What it means
Thrown when the driver fails to export a data dump while creating a seed file with --from-table. ExportDatadump runs a COPY/table export query on the source database; any driver-level or connection failure surfaces here. Note --from-table is only supported for postgres sources on CLI V3+.
Source
Thrown at cli/commands/seed_create.go:140
}
createSeedOpts := seed.CreateSeedOpts{
UserProvidedSeedName: o.SeedName,
DirectoryPath: filepath.Join(o.EC.SeedsDirectory, o.Source.Name),
}
// If we are initializing from a database table
// create a hasura client and add table name opts
if createSeedOpts.Data == nil {
var body []byte
if len(o.FromTableNames) > 0 {
if o.Source.Kind != hasura.SourceKindPG && o.EC.Config.Version >= cli.V3 {
return errors.E(op, "--from-table is supported only for postgres databases")
}
// Send the query
bodyReader, err := o.Driver.ExportDatadump(o.FromTableNames, o.Source.Name)
if err != nil {
return errors.E(op, fmt.Errorf("exporting seed data: %w", err))
}
body, err = io.ReadAll(bodyReader)
if err != nil {
return errors.E(op, err)
}
} else {
const defaultText = ""
var err error
body, err = editor.CaptureInputFromEditor(
editor.GetPreferredEditorFromEnvironment,
defaultText,
"sql",
)
if err != nil {
return errors.E(op, fmt.Errorf("cannot find default editor from env: %w", err))View on GitHub (pinned to 724551b9ae)
Solutions
- Verify the table exists in the source database and the name/schema is spelled correctly (check current_database()/search_path)
- Check DB credentials/permissions for COPY or SELECT on the table
- Upgrade metadata config to V3 and ensure the source is postgres when using --from-table
Example fix
// before hasura seed create seed1 --from-table nonexistent_table // after hasura seed create seed1 --from-table public.users
Defensive patterns
Strategy: validation
Validate before calling
// verify the table exists before exporting
var n int
err := db.QueryRow(`SELECT 1 FROM information_schema.tables WHERE table_schema = $1 AND table_name = $2`, schema, table).Scan(&n)
if err != nil || n == 0 {
return fmt.Errorf("table %s.%s not found", schema, table)
} Try / catch
if err := seedCreate.Run(); err != nil {
if strings.Contains(err.Error(), "exporting seed data") {
// inspect inner error: connectivity vs missing table
log.Printf("export failed, check table name and DB access: %v", err)
}
} Prevention
- Use schema-qualified table names with --from-table
- Ensure --from-table is only used against postgres sources with V3 config
When it happens
Trigger: Running `hasura seed create --from-table <t>` where the postgres COPY/export query fails: table doesn't exist, insufficient permissions, or connection loss. Also triggered for non-postgres sources with --from-table when EC.Config.Version < cli.V3 (the kind guard is bypassed on older config versions).
Common situations: Typo in table name, table in a different schema, read-restricted role, or using --from-table with an MSSQL source on an old metadata config version.
Related errors
- error while applying seeds for database '%s': %w
- cannot find default editor from env: %w
- failed to create seed file: %w
- error serving console: %w
- operation failed: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/19b01ef99a36fbf1.
Report an issue: GitHub.