flowable/flowable-engine · error · FlowableException

Error while invoking '${name}' on class ${target.getClass().

Error message

Error while invoking '${name}' on class ${target.getClass().getName()}

What it means

Flowable wraps an IllegalArgumentException thrown when reflectively invoking a setter method via Method.invoke(). It means the supplied value's type is not compatible with the setter's declared parameter type, or the number of arguments is wrong. Flowable rethrows it as a FlowableException naming the property and target class.

Source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/ReflectUtil.java:254

            for (Method method : methods) {
                if (method.getName().equals(setterName)) {
                    Class<?>[] paramTypes = method.getParameterTypes();
                    if (paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) {
                        return method;
                    }
                }
            }
            return null;
        } catch (SecurityException e) {
            throw new FlowableException("Not allowed to access method " + setterName + " on class " + clazz.getCanonicalName(), e);
        }
    }
    
    public static void invokeSetter(Method setterMethod, Object target, String name, Object value) {
        try {
            setterMethod.invoke(target, value);
        } catch (IllegalArgumentException e) {
            throw new FlowableException("Error while invoking '" + name + "' on class " + target.getClass().getName(), e);
        } catch (IllegalAccessException e) {
            throw new FlowableException("Illegal access when calling '" + name + "' on class " + target.getClass().getName(), e);
        } catch (InvocationTargetException e) {
            throw new FlowableException("Exception while invoking '" + name + "' on class " + target.getClass().getName(), e);
        }
    }

    private static Method findMethod(Class<? extends Object> clazz, String methodName, Object[] args) {
        for (Method method : clazz.getDeclaredMethods()) {
            // TODO add parameter matching
            if (method.getName().equals(methodName) && matches(method.getParameterTypes(), args)) {
                return method;
            }
        }
        Class<?> superClass = clazz.getSuperclass();
        if (superClass != null) {
            return findMethod(superClass, methodName, args);
        }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check the exception's cause chain for the IllegalArgumentException message naming the expected argument type
  2. Fix the configured value type so it matches the setter parameter (e.g. use "true"/"false" strings for booleans, numeric strings for ints)
  3. Verify the target class's setter signature matches what the caller passes
  4. If caused by a Flowable version upgrade, check the migration notes for changed setter signatures

Example fix

// before
engineConfig.getBeanValue("historyLevel").setValue("AUDIT") // AuditHistoryLevel object passed where String expected
// after
engineConfig.getBeanValue("historyLevel").setValue("audit") // correct type for the setter
Defensive patterns

Strategy: try-catch

Validate before calling

Method m = target.getClass().getMethod("setHistoryLevel", String.class);
if (!m.getParameterTypes()[0].isInstance(value)) throw new IllegalStateException("value type mismatch for setter");

Type guard

boolean isAssignable(Object value, Method setter) {
    return value == null || !setter.getParameterTypes()[0].isPrimitive() &&
        setter.getParameterTypes()[0].isInstance(value);
}

Try / catch

try {
    ReflectUtil.invokeSetter(setter, target, name, value);
} catch (FlowableException e) {
    logger.error("Setter invocation failed for " + name, e.getCause());
}

Prevention

When it happens

Trigger: ReflectUtil.invokeSetter is called (typically via invokeSetterOrField during engine configuration bean injection) with a value whose runtime type cannot be assigned to the setter's parameter (e.g. passing a String where an int is expected).

Common situations: Misconfigured XML/config properties where a property value string cannot be coerced to the bean setter's type; version changes that altered a setter's parameter type; passing null or wrong-typed values into reflective bean population.

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/56331372533bb98b. Report an issue: GitHub.