flowable/flowable-engine · error · FlowableIllegalArgumentException

taskId is required

Error message

taskId is required

What it means

GetHistoricEntityLinkChildrenForTaskCmd returns historic entity links that are children of a given task. Its constructor throws FlowableIllegalArgumentException when taskId is null, mirroring the fail-fast argument validation used across Flowable command implementations.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricEntityLinkChildrenForTaskCmd.java:34

import java.util.List;

import org.flowable.cmmn.engine.CmmnEngineConfiguration;
import org.flowable.cmmn.engine.impl.util.CommandContextUtil;
import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.api.scope.ScopeTypes;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.entitylink.api.EntityLinkType;
import org.flowable.entitylink.api.history.HistoricEntityLink;

public class GetHistoricEntityLinkChildrenForTaskCmd implements Command<List<HistoricEntityLink>>, Serializable {

    private static final long serialVersionUID = 1L;
    protected String taskId;

    public GetHistoricEntityLinkChildrenForTaskCmd(String taskId) {
        if (taskId == null) {
            throw new FlowableIllegalArgumentException("taskId is required");
        }
        this.taskId = taskId;
    }

    @Override
    public List<HistoricEntityLink> execute(CommandContext commandContext) {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        return cmmnEngineConfiguration.getEntityLinkServiceConfiguration().getHistoricEntityLinkService()
                .findHistoricEntityLinksByScopeIdAndScopeType(taskId, ScopeTypes.TASK, EntityLinkType.CHILD);
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Supply a valid non-null taskId before constructing the command.
  2. Verify the caller actually has a task context (e.g. DelegateTask.getId()) instead of a null field.
  3. Validate the id at the API/HTTP layer and reject requests missing the task id.

Example fix

// before
historyService.getHistoricEntityLinkChildrenForTask(taskId);
// after
if (taskId == null || taskId.isEmpty()) {
    throw new IllegalArgumentException("taskId must be provided");
}
historyService.getHistoricEntityLinkChildrenForTask(taskId);
Defensive patterns

Strategy: validation

Validate before calling

if (taskId == null || taskId.isEmpty()) { throw new IllegalArgumentException("taskId must be provided"); }

Type guard

boolean hasTaskId = s != null && !s.trim().isEmpty();

Try / catch

try { ... } catch (FlowableIllegalArgumentException e) { throw new BadRequestException("taskId is required"); }

Prevention

When it happens

Trigger: Calling new GetHistoricEntityLinkChildrenForTaskCmd(null), or an upstream service method that resolves the taskId from a nullable source (request parameter, map, entity field) and forwards null.

Common situations: Task id lost between layers (e.g. a delegate or listener with no task context), wrong parameter order in a call, or a REST layer not mapping the task id path variable.

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/654639bbdc4664cf. Report an issue: GitHub.