flowable/flowable-engine · error · FlowableIllegalArgumentException
The maximum allowed length must be greater than 0
Error message
The maximum allowed length must be greater than 0
What it means
Constructor guard: MaxAllowedLengthVariableVerifier rejects a configured maximum length of zero or negative at construction time. The verifier exists to enforce DB column length limits for variables; an unusable limit is refused immediately.
Source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/variable/MaxAllowedLengthVariableVerifier.java:30
*/
package org.flowable.common.engine.impl.variable;
import org.apache.commons.lang3.StringUtils;
import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.api.scope.ScopeTypes;
import org.flowable.variable.api.types.ValueFields;
import org.flowable.variable.api.types.VariableType;
/**
* @author Filip Hrisafov
*/
public class MaxAllowedLengthVariableVerifier implements VariableLengthVerifier {
protected final int maxAllowedLength;
public MaxAllowedLengthVariableVerifier(int maxAllowedLength) {
if (maxAllowedLength <= 0) {
throw new FlowableIllegalArgumentException("The maximum allowed length must be greater than 0");
}
this.maxAllowedLength = maxAllowedLength;
}
@Override
public void verifyLength(int length, ValueFields valueFields, VariableType variableType) {
if (length > maxAllowedLength) {
String scopeId;
String scopeType;
if (StringUtils.isNotEmpty(valueFields.getTaskId())) {
scopeId = valueFields.getTaskId();
scopeType = ScopeTypes.TASK;
} else if (StringUtils.isNotEmpty(valueFields.getProcessInstanceId())) {
scopeId = valueFields.getProcessInstanceId();
scopeType = ScopeTypes.BPMN;
} else {
scopeId = valueFields.getScopeId();
scopeType = valueFields.getScopeType();View on GitHub (pinned to d6d39ce1c6)
Solutions
- Pass a positive integer for maxAllowedLength (e.g. the DB column length, commonly 4001 for text columns)
- Check the config property feeding the value — ensure it parses to the intended positive number
- Remove/omit the verifier if no length limit is needed
Example fix
// before new MaxAllowedLengthVariableVerifier(0); // after new MaxAllowedLengthVariableVerifier(4001);
Defensive patterns
Strategy: validation
Validate before calling
if (maxAllowedLength == null || maxAllowedLength <= 0)
throw new IllegalArgumentException("maxAllowedLength must be > 0, got: " + maxAllowedLength); Type guard
boolean isValidMaxLength(Integer len) {
return len != null && len > 0;
} Try / catch
try {
new MaxAllowedLengthVariableVerifier(cfgLen);
} catch (FlowableIllegalArgumentException e) {
logger.error("Invalid verifier limit, falling back to default", e);
verifier = new MaxAllowedLengthVariableVerifier(4001);
} Prevention
- Wire the limit from the actual DB column size
- Validate config properties parse to positive integers
- Never use 0/-1 as placeholder limits
When it happens
Trigger: Creating a MaxAllowedLengthVariableVerifier (directly or via engine configuration wiring a variable length verifier) with maxAllowedLength <= 0.
Common situations: Configuration mistakes like 0 or -1 placeholders; computing the limit from a property that failed to parse; copy-paste of the wrong constant.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/7f9bd27d6ff35837.
Report an issue: GitHub.