alibaba/DataX · error · IllegalArgumentException
label length over limit(${maxLabelLength})
Error message
label length over limit(${maxLabelLength}) What it means
GdbElement.setLabel enforces MapperConfig.getMaxLabelLength() (typically 256) on element labels. A label resolved from the record longer than the limit throws IllegalArgumentException at mapping time. For edges with null id, label is checked after UUID generation — so label length applies equally to vertices and edges.
Source
Thrown at gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/model/GdbElement.java:40
return this.id;
}
public void setId(final String id) {
final int maxIdLength = MapperConfig.getInstance().getMaxIdLength();
if (id.length() > maxIdLength) {
throw new IllegalArgumentException("id length over limit(" + maxIdLength + ")");
}
this.id = id;
}
public String getLabel() {
return this.label;
}
public void setLabel(final String label) {
final int maxLabelLength = MapperConfig.getInstance().getMaxLabelLength();
if (label.length() > maxLabelLength) {
throw new IllegalArgumentException("label length over limit(" + maxLabelLength + ")");
}
this.label = label;
}
public List<GdbProperty> getProperties() {
return this.properties;
}
public void addProperty(final String propKey, final Object propValue, final PropertyType card) {
if (propKey == null || propValue == null) {
return;
}
final int maxPropKeyLength = MapperConfig.getInstance().getMaxPropKeyLength();
if (propKey.length() > maxPropKeyLength) {
throw new IllegalArgumentException("property key length over limit(" + maxPropKeyLength + ")");
}
if (propValue instanceof String) {View on GitHub (pinned to 80ec23d5c5)
Solutions
- Use a short, sanitized label vocabulary (enum-like) instead of free-text labels
- Truncate/normalize long label values deterministically in the reader transform or SQL
- Pre-check max label length in the source before the migration job
Example fix
-- before
SELECT concat('event_', event_name) AS label ...
-- after
SELECT concat('event_', md5(event_name)) AS label ... -- bounded length Defensive patterns
Strategy: validation
Validate before calling
static String safeLabel(String raw) {
int max = MapperConfig.getInstance().getMaxLabelLength();
return raw.length() <= max ? raw : raw.substring(0, max - 8) + "_" + DigestUtils.md5Hex(raw).substring(0, 7);
} Type guard
static boolean isValidGdbLabel(String s) {
return s != null && !s.isEmpty() && s.length() <= MapperConfig.getInstance().getMaxLabelLength();
} Try / catch
catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("label length over limit")) {
// normalize label source to a short controlled vocabulary
}
} Prevention
- Use fixed enum-style labels; never derive labels from free-text source columns
- Pre-scan label column lengths in the source before the job
When it happens
Trigger: Label column values exceeding the limit: dynamic labels like 'event_' + timestamp, long descriptive names from a source table's type/department column, or a mapping rule that concatenates fields into the label.
Common situations: Label generated from data instead of a fixed constant (e.g. per-category vertex labels from a category description column); denormalized sources where the type column is free text; no label at all is also invalid but fails the earlier 'id or label missed' check instead.
Related errors
- from length over limit(${maxIdLength})
- to length over limit(${maxIdLength})
- id length over limit(${maxIdLength})
- property key length over limit(${maxPropKeyLength})
- to or from missed in edge
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/fc7f6c84d12794cf.
Report an issue: GitHub.