{"record":{"id":"d4a6b16c812df5a1","repo":"flowable/flowable-engine","slug":"the-length-of-the-variabletype-gettypename-va","errorCode":null,"errorMessage":"The length of the ${variableType.getTypeName()} value exceeds the maximum allowed length of ${maxAllowedLength} characters. Current length: ${length}, for variable: ${valueFields.getName()} in scope ${scopeType} with id ${scopeId}","messagePattern":"The length of the (.+?) value exceeds the maximum allowed length of (.+?) characters\\. Current length: (.+?), for variable: (.+?) in scope (.+?) with id (.+?)","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/variable/MaxAllowedLengthVariableVerifier.java","lineNumber":50,"sourceCode":"        this.maxAllowedLength = maxAllowedLength;\n    }\n\n    @Override\n    public void verifyLength(int length, ValueFields valueFields, VariableType variableType) {\n        if (length > maxAllowedLength) {\n            String scopeId;\n            String scopeType;\n            if (StringUtils.isNotEmpty(valueFields.getTaskId())) {\n                scopeId = valueFields.getTaskId();\n                scopeType = ScopeTypes.TASK;\n            } else if (StringUtils.isNotEmpty(valueFields.getProcessInstanceId())) {\n                scopeId = valueFields.getProcessInstanceId();\n                scopeType = ScopeTypes.BPMN;\n            } else {\n                scopeId = valueFields.getScopeId();\n                scopeType = valueFields.getScopeType();\n            }\n            throw new FlowableIllegalArgumentException(\n                    \"The length of the \" + variableType.getTypeName() + \" value exceeds the maximum allowed length of \" + maxAllowedLength\n                            + \" characters. Current length: \" + length\n                            + \", for variable: \" + valueFields.getName() + \" in scope \" + scopeType + \" with id \" + scopeId);\n        }\n    }\n\n}\n","sourceCodeStart":32,"sourceCodeEnd":58,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/variable/MaxAllowedLengthVariableVerifier.java#L32-L58","documentation":"Thrown when verifyLength detects a variable value longer than the configured maxAllowedLength. The message names the variable type, limit, actual length, variable name, scope type and scope id. This prevents silent truncation or DB errors when persisting oversized variable values (e.g. text longer than the VARCHAR column).","triggerScenarios":"Setting a process/case/task variable whose serialized value length exceeds maxAllowedLength — e.g. storing a long string, JSON, or serialized Java object in a column-limited DB.","commonSituations":"Large payloads stored as string variables instead of files; long JSON documents; DB migration to a column with smaller capacity; user-generated content exceeding the 4001-char typical limit.","solutions":["Shorten the variable value (trim, compress, or split it)","Store large payloads as a file/content reference or use a different variable type (e.g. ByteArray/blobs with appropriate column sizes)","Increase the DB column size (e.g. ACT_GE_BYTEARRAY / ACT_RU_VARIABLE TEXT column) and the verifier limit accordingly","Adjust the configured maxAllowedLength to match the actual column capacity"],"exampleFix":"// before\nruntimeService.setVariable(taskId, \"payload\", hugeJsonString); // 9000 chars, limit 4001\n// after\nruntimeService.setVariable(taskId, \"payloadRef\", fileStore.save(hugeJsonString)); // store reference instead","handlingStrategy":"validation","validationCode":"if (value != null && value.length() > 4001) {\n    throw new IllegalArgumentException(\"variable value too long: \" + value.length());\n}","typeGuard":"boolean withinLimit(String s, int max) {\n    return s == null || s.length() <= max;\n}","tryCatchPattern":"try {\n    runtimeService.setVariable(scopeId, name, value);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"exceeds the maximum allowed length\")) {\n        runtimeService.setVariable(scopeId, name, storeExternally(value));\n    }\n}","preventionTips":["Check value length before setting text variables","Store large payloads externally and keep a reference variable","Align maxAllowedLength with the actual DB column capacity","Monitor user-generated content sizes flowing into variables"],"tags":["validation","variables","database"],"backgroundTag":"value-out-of-range","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}