{"record":{"id":"19b01ef99a36fbf1","repo":"hasura/graphql-engine","slug":"exporting-seed-data-w","errorCode":null,"errorMessage":"exporting seed data: %w","messagePattern":"exporting seed data: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/seed_create.go","lineNumber":140,"sourceCode":"\t}\n\n\tcreateSeedOpts := seed.CreateSeedOpts{\n\t\tUserProvidedSeedName: o.SeedName,\n\t\tDirectoryPath:        filepath.Join(o.EC.SeedsDirectory, o.Source.Name),\n\t}\n\t// If we are initializing from a database table\n\t// create a hasura client and add table name opts\n\tif createSeedOpts.Data == nil {\n\t\tvar body []byte\n\n\t\tif len(o.FromTableNames) > 0 {\n\t\t\tif o.Source.Kind != hasura.SourceKindPG && o.EC.Config.Version >= cli.V3 {\n\t\t\t\treturn errors.E(op, \"--from-table is supported only for postgres databases\")\n\t\t\t}\n\t\t\t// Send the query\n\t\t\tbodyReader, err := o.Driver.ExportDatadump(o.FromTableNames, o.Source.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.E(op, fmt.Errorf(\"exporting seed data: %w\", err))\n\t\t\t}\n\n\t\t\tbody, err = io.ReadAll(bodyReader)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.E(op, err)\n\t\t\t}\n\t\t} else {\n\t\t\tconst defaultText = \"\"\n\n\t\t\tvar err error\n\n\t\t\tbody, err = editor.CaptureInputFromEditor(\n\t\t\t\teditor.GetPreferredEditorFromEnvironment,\n\t\t\t\tdefaultText,\n\t\t\t\t\"sql\",\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.E(op, fmt.Errorf(\"cannot find default editor from env: %w\", err))","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/seed_create.go#L122-L158","documentation":"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+.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nhasura seed create seed1 --from-table nonexistent_table\n// after\nhasura seed create seed1 --from-table public.users","handlingStrategy":"validation","validationCode":"// verify the table exists before exporting\nvar n int\nerr := db.QueryRow(`SELECT 1 FROM information_schema.tables WHERE table_schema = $1 AND table_name = $2`, schema, table).Scan(&n)\nif err != nil || n == 0 {\n    return fmt.Errorf(\"table %s.%s not found\", schema, table)\n}","typeGuard":null,"tryCatchPattern":"if err := seedCreate.Run(); err != nil {\n    if strings.Contains(err.Error(), \"exporting seed data\") {\n        // inspect inner error: connectivity vs missing table\n        log.Printf(\"export failed, check table name and DB access: %v\", err)\n    }\n}","preventionTips":["Use schema-qualified table names with --from-table","Ensure --from-table is only used against postgres sources with V3 config"],"tags":["hasura","seed","export","postgres","cli"],"backgroundTag":"database-export-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}