{"record":{"id":"5fffc7f04612a24f","repo":"alibaba/DataX","slug":"id-length-over-limit-maxidlength","errorCode":null,"errorMessage":"id length over limit(${maxIdLength})","messagePattern":"id length over limit\\((.+?)\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/model/GdbElement.java","lineNumber":28,"sourceCode":"import com.alibaba.datax.plugin.writer.gdbwriter.mapping.MapperConfig;\n\n/**\n * @author jerrywang\n *\n */\npublic class GdbElement {\n    private String id = null;\n    private String label = null;\n    private List<GdbProperty> properties = new LinkedList<>();\n\n    public String getId() {\n        return this.id;\n    }\n\n    public void setId(final String id) {\n        final int maxIdLength = MapperConfig.getInstance().getMaxIdLength();\n        if (id.length() > maxIdLength) {\n            throw new IllegalArgumentException(\"id length over limit(\" + maxIdLength + \")\");\n        }\n        this.id = id;\n    }\n\n    public String getLabel() {\n        return this.label;\n    }\n\n    public void setLabel(final String label) {\n        final int maxLabelLength = MapperConfig.getInstance().getMaxLabelLength();\n        if (label.length() > maxLabelLength) {\n            throw new IllegalArgumentException(\"label length over limit(\" + maxLabelLength + \")\");\n        }\n        this.label = label;\n    }\n\n    public List<GdbProperty> getProperties() {\n        return this.properties;","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/model/GdbElement.java#L10-L46","documentation":"GdbElement.setId enforces the GDB maximum id length on every element (vertex or edge). If the resolved id string exceeds MapperConfig.getMaxIdLength(), IllegalArgumentException is thrown during record mapping — before any write to the graph database.","triggerScenarios":"Any gdbwriter import where the record's id column value is longer than maxIdLength: natural keys like emails/URLs/paths, concatenated composite keys, or untrimmed whitespace-padded keys.","commonSituations":"Using email or URL as the vertex id (URLs exceed 256 easily); composite keys built as a+b+c; migrating from Neo4j/RDBMS without key-length policy; edge ids are usually UUIDs (36 chars) so this mostly hits vertex ids.","solutions":["Switch to a bounded synthetic id (UUID or fixed-length hash of the natural key) and store the natural key as a property for lookup","Pre-validate: SELECT count(*) WHERE length(id_col) > 256 must return 0 before the job","If a longer limit is supported by your GDB version, raise MapperConfig's maxIdLength accordingly"],"exampleFix":"// before\nString id = record.getEmail();\n// after\nString id = \"user_\" + DigestUtils.md5Hex(record.getEmail());","handlingStrategy":"validation","validationCode":"static String safeGdbId(String naturalKey) {\n    return naturalKey.length() <= MapperConfig.getInstance().getMaxIdLength()\n        ? naturalKey\n        : \"h_\" + DigestUtils.md5Hex(naturalKey);\n}","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(\"id length over limit\")) {\n        // switch to hashed/synthetic ids; keep the natural key as a property for lookup\n    }\n}","preventionTips":["Never use URLs/emails/free text directly as vertex ids — hash them first","Pre-scan id column lengths; keep a margin below the limit"],"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"}