flowable/flowable-engine · error · FlowableIllegalArgumentException

Illegal value for delegationState

Error message

Illegal value for delegationState: {delegationState}

What it means

FlowableIllegalArgumentException thrown when a task query includes a delegationState request parameter whose value is neither 'pending' nor 'resolved' (case-insensitive). Only those two DelegationState values are accepted by this converter.

Solutions

  1. Send only 'pending' or 'resolved' (case-insensitive) as delegationState
  2. Omit the parameter entirely to get all tasks regardless of delegation state
  3. Check the client's enum mapping against Flowable's DelegationState
  4. Trim whitespace and remove accidental suffixes from the parameter

Example fix

// before
GET /runtime/tasks?delegationState=delegated
// after
GET /runtime/tasks?delegationState=pending
Defensive patterns

Strategy: validation

Validate before calling

const VALID = ['pending','resolved'];
if (delegationState != null && !VALID.includes(delegationState.toLowerCase().trim())) throw new Error(`delegationState must be 'pending' or 'resolved', got: ${delegationState}`);

Type guard

function isDelegationState(v) { return v == null || ['pending','resolved'].includes(String(v).toLowerCase().trim()); }

Try / catch

try { return await api.queryTasks({ delegationState }); } catch (e) { if (e.status === 400 && /delegationState/.test(e.message)) { return api.queryTasks({}); } throw e; }

Prevention

When it happens

Trigger: Task list query GET /runtime/tasks?delegationState=foo (or 'resolve', 'resolved ', uppercase variants are fine — only unknown words fail) where the string doesn't match PENDING or RESOLVED.

Common situations: Clients sending their own enum spellings ('delegated', 'resolve'); an extra null/empty variant the API doesn't support; API-version drift where a client expects more states than Flowable defines.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskBaseResource.java:83

    @Autowired
    protected TaskService taskService;

    @Autowired
    protected HistoryService historyService;
    
    @Autowired(required=false)
    protected BpmnRestApiInterceptor restApiInterceptor;

    protected DelegationState getDelegationState(String delegationState) {
        DelegationState state = null;
        if (delegationState != null) {
            if (DelegationState.RESOLVED.name().toLowerCase().equals(delegationState)) {
                return DelegationState.RESOLVED;
            } else if (DelegationState.PENDING.name().toLowerCase().equals(delegationState)) {
                return DelegationState.PENDING;
            } else {
                throw new FlowableIllegalArgumentException("Illegal value for delegationState: " + delegationState);
            }
        }
        return state;
    }

    /**
     * Populate the task based on the values that are present in the given {@link TaskRequest}.
     */
    protected void populateTaskFromRequest(Task task, TaskRequest taskRequest) {
        if (taskRequest.isNameSet()) {
            task.setName(taskRequest.getName());
        }
        if (taskRequest.isAssigneeSet()) {
            task.setAssignee(taskRequest.getAssignee());
        }
        if (taskRequest.isDescriptionSet()) {
            task.setDescription(taskRequest.getDescription());
        }

View on GitHub (pinned to d6d39ce1c6)