alibaba/DataX · error · IllegalArgumentException

id or label missed

Error message

id or label missed

What it means

DefaultGdbMapper requires every element to end with non-null id and label. For edges, a null id is auto-filled with a random UUID, but a null label is fatal; for vertices both id and label are required. If either is still null at the check, IllegalArgumentException is thrown with the invalid values logged.

Source

Thrown at gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/mapping/DefaultGdbMapper.java:109

            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);

            properties.forEach(p -> p.accept(r, e));
        };
        return ret;
    }

    private static Function<Record, Object> forObjColumn(final boolean numPattern, final String rule, final ValueType type) {
        final Pattern pattern = numPattern ? NORMAL_NUM_PATTERN : NORMAL_DOLLAR_PATTERN;
        final Matcher m = pattern.matcher(rule);
        if (m.matches()) {
            final int index = Integer.valueOf(m.group(1));
            return r -> type.applyColumn(r.getColumn(index));
        } else {
            return r -> type.fromStrFunc(rule);

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Read the 'invalid record id: {}, label: {}' log line to see which field is null
  2. Guarantee non-null id/label at the source or filter such rows in the reader
  3. Cross-check reader column order and writer 'column' mapping (index/name) for the id and label entries
  4. For edges only: leave id unmapped to get an auto-generated UUID if synthetic ids are acceptable

Example fix

// before: id column may be null
// after: derive id via function or filter
reader: "where": "pk is not null"
Defensive patterns

Strategy: validation

Validate before calling

// reader-level guard: rows must carry id and label
"where": "pk IS NOT NULL AND type IS NOT NULL"

Try / catch

catch (IllegalArgumentException e) {
    if ("id or label missed".equals(e.getMessage())) {
        // vertex import: id cannot be auto-generated (only edge ids get UUIDs); supply or filter
    }
    throw e;
}

Prevention

When it happens

Trigger: The record's id/label column resolves to null: source NULL values, wrong column index/name in the mapping, or label column missing from the reader's column projection entirely. For vertex import, a null id always lands here (UUID generation only applies to edges).

Common situations: Vertex jobs where the primary-key column has NULLs; label column name mismatch between reader and writer configs; column order shifts after adding a field upstream; blank strings are fine (non-null), so this is specifically about true nulls.

Related errors


AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14). Data as JSON: /api/errors/2ff75eefa05a3c22. Report an issue: GitHub.