alibaba/DataX · error · IllegalArgumentException

to length over limit(${maxIdLength})

Error message

to length over limit(${maxIdLength})

What it means

GdbEdge.setTo mirrors setFrom: it enforces MapperConfig.getMaxIdLength() on the edge's destination vertex id and throws IllegalArgumentException when the 'to' value exceeds it. Validation happens at object-build time inside the mapper, before the element is sent to GDB.

Source

Thrown at gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/model/GdbEdge.java:40

        return this.from;
    }

    public void setFrom(final String from) {
        final int maxIdLength = MapperConfig.getInstance().getMaxIdLength();
        if (from.length() > maxIdLength) {
            throw new IllegalArgumentException("from length over limit(" + maxIdLength + ")");
        }
        this.from = from;
    }

    public String getTo() {
        return this.to;
    }

    public void setTo(final String to) {
        final int maxIdLength = MapperConfig.getInstance().getMaxIdLength();
        if (to.length() > maxIdLength) {
            throw new IllegalArgumentException("to length over limit(" + maxIdLength + ")");
        }
        this.to = to;
    }
}

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Apply a deterministic shortening (hash/truncate) to the to-column value, identical to the one used for the destination vertex's own id
  2. Confirm the effective limit from the exception message and keep ids comfortably below it
  3. Validate max(len(to_col)) in the source with SQL before running the migration

Example fix

-- before: check nothing
SELECT max(length(fk_to)) FROM edges;
-- after: pre-validate
SELECT count(*) FROM edges WHERE length(fk_to) > 256;  -- must be 0
Defensive patterns

Strategy: validation

Validate before calling

-- pre-migration SQL check (must return 0)
SELECT count(*) FROM edge_src WHERE length(fk_to) > 256;

Type guard

static boolean isValidGdbId(String s) {
    return s != null && !s.isEmpty() && s.length() <= MapperConfig.getInstance().getMaxIdLength();
}

Try / catch

catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("to length over limit")) {
        // shorten destination ids deterministically; keep destination vertex ids in sync
    }
}

Prevention

When it happens

Trigger: importType=EDGE with a to-column value longer than the configured max id length; typically the same class of data as the from-side check but hitting the destination column first if it is the longer one.

Common situations: Composite/concatenated destination keys; upstream schema change that lengthened the target-key column; only 'to' exceeding the limit (from passes) so the error singles out destination ids.

Related errors


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