dgraph-io/dgraph · error
while dumping table %s
Error message
while dumping table %s
What it means
dumpTables first phase calls dumpTable for every table in m.tableInfos, which reads all SQL rows and emits RDF data to the data writer. If any per-table dump fails (SQL query error, scan error, getValue error), it is wrapped with "while dumping table <name>" so the offending table is identified.
Source
Thrown at dgraph/cmd/migrate/dump.go:74
tableInfo := m.tableInfos[table]
for _, index := range createDgraphSchema(tableInfo) {
_, err := m.schemaWriter.WriteString(index)
if err != nil {
return errors.Wrapf(err, "while writing schema")
}
}
}
return m.schemaWriter.Flush()
}
// dumpTables goes through all the tables twice. In the first time it generates RDF entries for the
// column values. In the second time, it follows the foreign key constraints in SQL tables, and
// generate the corresponding Dgraph edges.
func (m *dumpMeta) dumpTables() error {
for table := range m.tableInfos {
fmt.Printf("Dumping table %s\n", table)
if err := m.dumpTable(table); err != nil {
return errors.Wrapf(err, "while dumping table %s", table)
}
}
for table := range m.tableInfos {
fmt.Printf("Dumping table constraints %s\n", table)
if err := m.dumpTableConstraints(table); err != nil {
return errors.Wrapf(err, "while dumping table %s", table)
}
}
return m.dataWriter.Flush()
}
// dumpTable converts the cells in a SQL table into RDF entries,
// and sends entries to the m.dataWriter
func (m *dumpMeta) dumpTable(table string) error {
tableGuide := m.tableGuides[table]
tableInfo := m.tableInfos[table]View on GitHub (pinned to 759e242be6)
Solutions
- Identify the table name embedded in the wrapped message and run a manual SELECT on it to find the bad rows.
- Fix NULL/invalid values in that table (or preprocess with COALESCE) before migrating.
- Verify DB connectivity and grants for the migrate user on that table.
- Rerun migrate; since it is a full dump, restart after fixing the data source.
Example fix
// before SELECT * FROM orders; -- row with NULL cust_id crashes dumpTable // after SELECT id, COALESCE(cust_id, 0) AS cust_id, ... FROM orders; -- or clean NULLs before migrating
Defensive patterns
Strategy: validation
Validate before calling
-- find problematic rows before migrating SELECT COUNT(*) FROM orders WHERE cust_id IS NULL OR id IS NULL;
Try / catch
if err := migrate.Run(); err != nil {
var tbl string
if m := tableRe.FindStringSubmatch(err.Error()); m != nil {
tbl = m[1] // parse table from "while dumping table X"
}
log.Printf("dump failed for table %s: %+v", tbl, err)
} Prevention
- Audit tables for NULLs and unsupported column types before migrating
- Verify DB connectivity and read grants for all in-scope tables
- Run migrations on a stable connection with adequate timeouts
When it happens
Trigger: m.dumpTable(table) returns an error for any table: the SELECT of the table fails, rows.Next() hits an unexpected driver error, or a row cell fails conversion in getValue (nil value, invalid NullInt64/NullTime/NullFloat64).
Common situations: MySQL connection dropped mid-migration; a table contains NULLs the converter rejects; unsupported column type causes type assertion panic/error downstream; insufficient privileges to read a table.
Related errors
- while writing data file
- nil value found
- found invalid nullint
- found invalid nulltime
- while writing schema
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/7844aea35e76f46f.
Report an issue: GitHub.