alibaba/DataX · error · IllegalArgumentException

from length over limit(${maxIdLength})

Error message

from length over limit(${maxIdLength})

What it means

GdbEdge.setFrom enforces GDB's maximum id length (MapperConfig.getMaxIdLength, typically 256) when setting the edge's source vertex id. An over-long 'from' id is rejected with IllegalArgumentException before any network call, since GDB would reject the element anyway.

Source

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

/**
 * @author jerrywang
 *
 */
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class GdbEdge extends GdbElement {
    private String from = null;
    private String to = null;

    public String getFrom() {
        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. Shorten the from id at the source: hash or truncate deterministically (and apply the same transform to the matching vertex ids so references stay consistent)
  2. Check the limit: MapperConfig default (256) vs your value — the exception prints maxIdLength
  3. Ensure BOTH the edge's from id and the target vertex's id use the same transformation or edges will dangle

Example fix

// before
String from = tableName + "_" + pk + "_" + ts;
// after
String from = tableName + "_" + DigestUtils.md5Hex(pk).substring(0, 16);
Defensive patterns

Strategy: validation

Validate before calling

static final int MAX_ID = MapperConfig.getInstance().getMaxIdLength();
void checkFrom(String from) { if (from != null && from.length() > MAX_ID) throw new IllegalArgumentException("from id too long: " + from.length()); }

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("from length over limit")) {
        // apply the same shortening to BOTH the edge.from and the referenced vertex id, else edges dangle
    }
}

Prevention

When it happens

Trigger: importType=EDGE with a from-column value longer than maxIdLength characters — e.g. composite keys concatenated from source tables, URLs, or hashed names exceeding the limit.

Common situations: Migrating from a store with unbounded key length; generated ids like table_name+pk+timestamp concatenations; hash-based ids with excessive length (SHA-512 hex = 128 chars is fine, but base64+prefixes may not be).

Related errors


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