{"record":{"id":"9eb530275f7c34f0","repo":"alibaba/DataX","slug":"request-length-over-limit-maxrequestlength","errorCode":null,"errorMessage":"request length over limit(${maxRequestLength})","messagePattern":"request length over limit\\((.+?)\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/model/ScriptGdbGraph.java","lineNumber":146,"sourceCode":"                firstAdd = false;\n                subParams.clear();\n                requestLength = idLength;\n            }\n\n            requestLength += appendLength;\n            subParams.add(entry);\n        }\n        if (!subParams.isEmpty() || firstAdd) {\n            checkSplitDsl(firstAdd, requestLength, attachLength, 0, 0);\n            setGraphDbElement(element, subParams, isVertex, firstAdd);\n        }\n    }\n\n    private boolean checkSplitDsl(final boolean firstAdd, final int requestLength, final int attachLength, final int appendLength,\n\t\t\t\t\t\t\t\t  final int propNum) {\n        final int length = firstAdd ? requestLength + attachLength : requestLength;\n        if (length > this.maxRequestLength) {\n            throw new IllegalArgumentException(\"request length over limit(\" + this.maxRequestLength + \")\");\n        }\n        return length + appendLength > this.maxRequestLength || propNum >= this.propertiesBatchNum;\n    }\n\n    private Tuple2<String, Map<String, Object>> buildDsl(final GdbElement element, final List<GdbElement.GdbProperty> properties,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t final boolean isVertex, final boolean firstAdd) {\n        final Map<String, Object> params = new HashMap<>();\n        final StringBuilder sb = new StringBuilder();\n        if (isVertex) {\n            sb.append(firstAdd ? ADD_V_START : UPDATE_V_START);\n        } else {\n            sb.append(firstAdd ? ADD_E_START : UPDATE_E_START);\n        }\n\n        for (int i = 0; i < properties.size(); i++) {\n            final GdbElement.GdbProperty prop = properties.get(i);\n\n            sb.append(\".property(\");","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/model/ScriptGdbGraph.java#L128-L164","documentation":"Thrown by ScriptGdbGraph.checkSplitDsl when the Gremlin script request built for one element exceeds maxRequestLength (the GDB server's script-request size cap). For the first add of an element the length is requestLength + attachLength (DSL text plus attachment bytes), so a single oversized element cannot be split further and fails immediately.","triggerScenarios":"Writing a vertex or edge whose accumulated DSL text plus attached property payloads (firstAdd case in setGraphDbElement -> checkSplitDsl(firstAdd=true, ...)) exceeds this.maxRequestLength; the batching logic can defer properties to follow-up requests, but a single element whose first request already exceeds the cap aborts.","commonSituations":"Importing elements with very large or very many String properties (JSON blobs, long text) into Alibaba GDB; multi-MB payloads per row; maxRequestLength left at default while source columns grew.","solutions":["Reduce per-element payload size: drop, truncate, or shrink large property values in the transformation step before they reach gdbwriter.","Lower the number of properties attached in the first request (propertiesBatchNum / mapper settings) so more properties go into follow-up update requests.","Verify the value of maxRequestLength in the gdbwriter config and align it with what the GDB server actually accepts; do not set it above the server cap."],"exampleFix":"// before\nrecord.put(\"description\", hugeJsonString); // 8MB string\n// after\nrecord.put(\"description\", hugeJsonString.substring(0, 60_000)); // keep within request cap","handlingStrategy":"validation","validationCode":"// estimate serialized size before writing\nint est = elementDslLength + serializedPropertyBytes(element);\nif (est > maxRequestLength) {\n    // split/shrink properties or fail this record with a clear message\n}","typeGuard":null,"tryCatchPattern":"try {\n    graph.setGraphDbElement(element, subParams, isVertex, firstAdd);\n} catch (IllegalArgumentException e) {\n    // deterministic data-size failure: shrink the element's properties, do not retry unchanged\n}","preventionTips":["Keep individual GDB elements well under the request cap; store large blobs externally and keep only references.","Tune propertiesBatchNum so property attach is spread over multiple requests.","Never raise maxRequestLength beyond what the GDB server accepts."],"tags":["gdb","graph-database","datax","request-size","validation"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}