flowable/flowable-engine · error · ActivitiIllegalArgumentException

Field definition uses unexisting field '%s' on class %s

Error message

Field definition uses unexisting field '%s' on class %s

What it means

Thrown when a BPMN field injection (flowable:field) references a field name that does not exist on the delegate class and no matching setter was found. The engine looks the field up via reflection and fails fast with ActivitiIllegalArgumentException.

Source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/ClassDelegateUtil.java:65

    public static void applyFieldDeclaration(FieldDeclaration declaration, Object target) {
        Method setterMethod = ReflectUtil.getSetter(declaration.getName(),
                target.getClass(), declaration.getValue().getClass());

        if (setterMethod != null) {
            try {
                setterMethod.invoke(target, declaration.getValue());
            } catch (IllegalArgumentException e) {
                throw new ActivitiException("Error while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e);
            } catch (IllegalAccessException e) {
                throw new ActivitiException("Illegal access when calling '" + declaration.getName() + "' on class " + target.getClass().getName(), e);
            } catch (InvocationTargetException e) {
                throw new ActivitiException("Exception while invoking '" + declaration.getName() + "' on class " + target.getClass().getName(), e);
            }
        } else {
            Field field = ReflectUtil.getField(declaration.getName(), target);
            if (field == null) {
                throw new ActivitiIllegalArgumentException("Field definition uses unexisting field '" + declaration.getName() + "' on class " + target.getClass().getName());
            }
            // Check if the delegate field's type is correct
            if (!fieldTypeCompatible(declaration, field)) {
                throw new ActivitiIllegalArgumentException("Incompatible type set on field declaration '" + declaration.getName()
                        + "' for class " + target.getClass().getName()
                        + ". Declared value has type " + declaration.getValue().getClass().getName()
                        + ", while expecting " + field.getType().getName());
            }
            ReflectUtil.setField(field, target, declaration.getValue());
        }
    }

    public static boolean fieldTypeCompatible(FieldDeclaration declaration, Field field) {
        if (declaration.getValue() != null) {
            return field.getType().isAssignableFrom(declaration.getValue().getClass());
        } else {
            // Null can be set any field type
            return true;

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Correct the flowable:field name attribute to match an existing field or setter on the delegate class
  2. Add the missing field (with public visibility or public setter) to the delegate class
  3. Compare the delegate class name in the XML class attribute against the intended class
  4. Rebuild/redeploy the process definition after fixing

Example fix

// before
<flowable:field name="retyCount" stringValue="3"/>
// after
<flowable:field name="retryCount" stringValue="3"/>
Defensive patterns

Strategy: validation

Validate before calling

boolean hasField = java.util.Arrays.stream(delegateClass.getDeclaredFields()).anyMatch(f -> f.getName().equals("retryCount"));

Prevention

When it happens

Trigger: flowable:field name attribute in the BPMN XML does not match any field or setter on the delegate class resolved for the service task/listener.

Common situations: Typo in the field name in the XML; renaming a field/setter in the delegate without updating process XML; copying XML between tasks that use different delegate classes.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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