flowable/flowable-engine · error · FlowableException

Value " " can not be converted into boolean

Error message

Value "${value}" can not be converted into boolean

What it means

ExpressionUtils.parseBoolean throws this when the resolved field value is neither a String nor a Boolean and not null — e.g. an Integer, Long, or other object. Flowable refuses to guess a boolean conversion for arbitrary types, unlike the String path which at least accepts 'true'/'false' text.

Solutions

  1. Convert the variable to a real Boolean before the HTTP task (Boolean.valueOf or explicit set in a script/listener)
  2. Change the expression to a coercion, e.g. ${flag == 1} when the variable is numeric
  3. Fix the upstream producer of the variable (script task, REST response mapping) to emit booleans

Example fix

// before
execution.setVariable("retryFlag", 1);
// after
execution.setVariable("retryFlag", true);
Defensive patterns

Strategy: type-guard

Validate before calling

Object v = execution.getVariable("flag");
if (!(v instanceof Boolean) && !(v instanceof String s && (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("false")))) {
    throw new IllegalArgumentException("flag must be Boolean or 'true'/'false' string");
}

Type guard

boolean isBooleanLike(Object v) { return v instanceof Boolean b || (v instanceof String s && (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("false"))); }

Prevention

When it happens

Trigger: A boolean field expression resolves to a non-boolean, non-string object, e.g. ${flag} pointing at an Integer variable set to 1, or a serialized object stored in a process variable being used where a boolean is expected.

Common situations: Setting process variables from scripts as numbers (flag=1) and then using them in boolean task attributes; variables populated from a JSON/API response where booleans were deserialized as integers.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/4724e68b19b709c2. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/ExpressionUtils.java:61

        if (expression != null) {
            Object value = expression.getValue(execution);
            return parseBoolean(value);
        }
        return false;
    }

    protected static boolean parseBoolean(Object value) {
        if (value != null) {
            if (value instanceof String stringValue) {
                if ("true".equalsIgnoreCase(stringValue) || "false".equalsIgnoreCase(stringValue)) {
                    return Boolean.parseBoolean(value.toString());
                }
                throw new FlowableException("String value \"" + value + "\" is not allowed in boolean expression");
            }
            if (value instanceof Boolean) {
                return (Boolean) value;
            }
            throw new FlowableException("Value \"" + value + "\" can not be converted into boolean");
        }
        return false;
    }

    public static String getStringFromField(final Expression expression, final VariableContainer execution) {
        if (expression != null) {
            Object value = expression.getValue(execution);
            if (value != null) {
                return value.toString();
            }
        }
        return null;
    }

    public static Set<String> getStringSetFromField(final String field) {
        String[] codes = field.split("\\s*,\\s*");
        Set<String> codeSet = new HashSet<>(Arrays.asList(codes));
        Collections.addAll(codeSet, codes);

View on GitHub (pinned to d6d39ce1c6)