alibaba/DataX · error · IllegalArgumentException
to or from missed in edge
Error message
to or from missed in edge
What it means
In gdbwriter's DefaultGdbMapper, for EDGE import type each record must produce non-null 'to' and 'from' vertex ids (resolved via forStrColumn from the configured column rules). If either resolves to null, the mapper throws IllegalArgumentException after logging the invalid record — an edge cannot exist without both endpoint ids.
Source
Thrown at gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/mapping/DefaultGdbMapper.java:96
if (key == null || name == null) {
continue;
}
addToProperties(e, key, name, type, card);
}
});
}
final BiConsumer<Record, GdbElement> ret = (r, e) -> {
final String label = forStrColumn(numPattern, rule.getLabel()).apply(r);
String id = forStrColumn(numPattern, rule.getId()).apply(r);
if (rule.getImportType() == Key.ImportType.EDGE) {
final String to = forStrColumn(numPattern, rule.getTo()).apply(r);
final String from = forStrColumn(numPattern, rule.getFrom()).apply(r);
if (to == null || from == null) {
log.error("invalid record to: {} , from: {}", to, from);
throw new IllegalArgumentException("to or from missed in edge");
}
((GdbEdge)e).setTo(to);
((GdbEdge)e).setFrom(from);
// generate UUID for edge
if (id == null) {
id = UUID.randomUUID().toString();
}
}
if (id == null || label == null) {
log.error("invalid record id: {} , label: {}", id, label);
throw new IllegalArgumentException("id or label missed");
}
e.setId(id);
e.setLabel(label);
View on GitHub (pinned to 80ec23d5c5)
Solutions
- Check the logged 'invalid record to: {}, from: {}' line to identify which side is null and for which record
- Fix null endpoint ids at the source or filter such rows (reader where-filter) before the writer
- Verify the writer's 'column' mapping: to/from entries must reference existing columns carrying vertex ids
- If null to/from is legitimately possible, decide policy (skip row) — the plugin has no skip option, so pre-filter
Example fix
// before: reader emits rows where fk can be null // after: filter at read time "where": "fk_to is not null and fk_from is null-free-equivalent"
Defensive patterns
Strategy: validation
Validate before calling
// filter rows lacking endpoint ids before the writer sees them (reader-level) "where": "fk_to IS NOT NULL AND fk_from IS NOT NULL"
Try / catch
catch (IllegalArgumentException e) {
if ("to or from missed in edge".equals(e.getMessage())) {
// log already printed the offending to/from; re-run with a where-filter to skip such rows
}
throw e;
} Prevention
- Add NOT NULL constraints (or reader where-filters) on endpoint foreign keys before edge migration
- Double-check writer column mapping order so to/from point at the actual id columns
When it happens
Trigger: gdbwriter job with importType=EDGE where the record's to/from column values are null, or the configured column index/name mapping for to/from does not exist so the rule resolves null. Also a '$to'/'$from' placeholder typo in the mapping JSON.
Common situations: Source rows with NULL foreign keys; writer column list order not matching the reader's column order so to/from point at wrong (possibly null) columns; mapping JSON referencing renamed columns after upstream schema change.
Related errors
- id or label missed
- Failed to cast %s to Long
- Failed to cast %s to Double
- Failed to cast %s to Boolean
- File not found: ${name}
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/2b3193fa9b95eabf.
Report an issue: GitHub.