flowable/flowable-engine · error · FlowableIllegalArgumentException

A group or a user is required to create an identity link.

Error message

A group or a user is required to create an identity link.

What it means

Creating an identity link on a CMMN task requires at least one of 'group' or 'user' in the RestIdentityLink body. If both are null, createIdentityLink throws FlowableIllegalArgumentException because the link would have no target.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskIdentityLinkCollectionResource.java:72

        }

        return restResponseFactory.createRestIdentityLinks(taskService.getIdentityLinksForTask(task.getId()));
    }

    @ApiOperation(value = "Create an identity link on a task", tags = { "Task Identity Links" }, nickname = "createTaskInstanceIdentityLinks",
            notes = "It is possible to add either a user or a group.", code = 201)
    @ApiResponses(value = {
            @ApiResponse(code = 201, message = "Indicates the task was found and the identity link was created."),
            @ApiResponse(code = 404, message = "Indicates the requested task was not found or the task does not have the requested identityLink. The status contains additional information about this error.")
    })
    @PostMapping(value = "/cmmn-runtime/tasks/{taskId}/identitylinks", produces = "application/json")
    @ResponseStatus(HttpStatus.CREATED)
    public RestIdentityLink createIdentityLink(@ApiParam(name = "taskId") @PathVariable("taskId") String taskId, @RequestBody RestIdentityLink identityLink) {

        Task task = getTaskFromRequestWithoutAccessCheck(taskId);

        if (identityLink.getGroup() == null && identityLink.getUser() == null) {
            throw new FlowableIllegalArgumentException("A group or a user is required to create an identity link.");
        }

        if (identityLink.getGroup() != null && identityLink.getUser() != null) {
            throw new FlowableIllegalArgumentException("Only one of user or group can be used to create an identity link.");
        }

        if (identityLink.getType() == null) {
            throw new FlowableIllegalArgumentException("The identity link type is required.");
        }

        if (restApiInterceptor != null) {
            restApiInterceptor.createTaskIdentityLink(task, identityLink);
        }

        if (identityLink.getGroup() != null) {
            taskService.addGroupIdentityLink(task.getId(), identityLink.getGroup(), identityLink.getType());
        } else {
            taskService.addUserIdentityLink(task.getId(), identityLink.getUser(), identityLink.getType());

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Set either the user or the group field in the RestIdentityLink request body
  2. Check the JSON field names match RestIdentityLink properties (user, group, type)
  3. Validate the body client-side before POSTing
  4. Handle the 400 response from FlowableIllegalArgumentException by correcting the payload

Example fix

// before
{"type":"candidate"}
// after
{"type":"candidate","user":"kermit"}
Defensive patterns

Strategy: validation

Validate before calling

if (!link.user && !link.group) throw new Error('A group or a user is required to create an identity link');

Type guard

const isLinkable = (l) => l != null && (typeof l.user === 'string' || typeof l.group === 'string');

Try / catch

try { await addIdentityLink(taskId, link); } catch (e) { if (e.message.includes('A group or a user is required')) { /* set user or group and retry */ } throw e; }

Prevention

When it happens

Trigger: POST /cmmn-runtime/tasks/{taskId}/identitylinks with a body containing only type (and maybe no user/group), or where user and group fields are omitted/null.

Common situations: Clients forgetting to set user or group; JSON field name mismatch (userId vs user); building links programmatically with only the type field populated.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — 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/cbbcee577de3e5ee. Report an issue: GitHub.