{"record":{"id":"6ccc0d449b3d5060","repo":"alibaba/DataX","slug":"from-length-over-limit-maxidlength","errorCode":null,"errorMessage":"from length over limit(${maxIdLength})","messagePattern":"from length over limit\\((.+?)\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/model/GdbEdge.java","lineNumber":28,"sourceCode":"\n/**\n * @author jerrywang\n *\n */\n@EqualsAndHashCode(callSuper = true)\n@ToString(callSuper = true)\npublic class GdbEdge extends GdbElement {\n    private String from = null;\n    private String to = null;\n\n    public String getFrom() {\n        return this.from;\n    }\n\n    public void setFrom(final String from) {\n        final int maxIdLength = MapperConfig.getInstance().getMaxIdLength();\n        if (from.length() > maxIdLength) {\n            throw new IllegalArgumentException(\"from length over limit(\" + maxIdLength + \")\");\n        }\n        this.from = from;\n    }\n\n    public String getTo() {\n        return this.to;\n    }\n\n    public void setTo(final String to) {\n        final int maxIdLength = MapperConfig.getInstance().getMaxIdLength();\n        if (to.length() > maxIdLength) {\n            throw new IllegalArgumentException(\"to length over limit(\" + maxIdLength + \")\");\n        }\n        this.to = to;\n    }\n}\n","sourceCodeStart":10,"sourceCodeEnd":45,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/model/GdbEdge.java#L10-L45","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["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)","Check the limit: MapperConfig default (256) vs your value — the exception prints maxIdLength","Ensure BOTH the edge's from id and the target vertex's id use the same transformation or edges will dangle"],"exampleFix":"// before\nString from = tableName + \"_\" + pk + \"_\" + ts;\n// after\nString from = tableName + \"_\" + DigestUtils.md5Hex(pk).substring(0, 16);","handlingStrategy":"validation","validationCode":"static final int MAX_ID = MapperConfig.getInstance().getMaxIdLength();\nvoid checkFrom(String from) { if (from != null && from.length() > MAX_ID) throw new IllegalArgumentException(\"from id too long: \" + from.length()); }","typeGuard":"static boolean isValidGdbId(String s) {\n    return s != null && !s.isEmpty() && s.length() <= MapperConfig.getInstance().getMaxIdLength();\n}","tryCatchPattern":"catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"from length over limit\")) {\n        // apply the same shortening to BOTH the edge.from and the referenced vertex id, else edges dangle\n    }\n}","preventionTips":["Pre-scan max(length(from_col)) in the source; it must be <= limit (printed in the exception)","Apply one deterministic shortening transform consistently to every place an id appears (edge.from, edge.to, vertex.id)"],"tags":["gdb","graph","validation","id-length"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}