flowable/flowable-engine · error · FlowableIllegalArgumentException
taskId is required
Error message
taskId is required
What it means
GetHistoricEntityLinkParentsForTaskCmd returns the historic entity link parents of a task. Its constructor throws FlowableIllegalArgumentException when taskId is null, consistent with Flowable's constructor-level null checks for command objects.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricEntityLinkParentsForTaskCmd.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 GetHistoricEntityLinkParentsForTaskCmd implements Command<List<HistoricEntityLink>>, Serializable {
private static final long serialVersionUID = 1L;
protected String taskId;
public GetHistoricEntityLinkParentsForTaskCmd(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()
.findHistoricEntityLinksByReferenceScopeIdAndType(taskId, ScopeTypes.TASK, EntityLinkType.CHILD);
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Pass a non-null taskId to the command.
- Capture DelegateTask.getId() inside task-scoped listeners instead of a nullable field.
- Validate the id before invoking the history service.
Example fix
// before new GetHistoricEntityLinkParentsForTaskCmd(taskInfo.getId()); // after String taskId = taskInfo != null ? taskInfo.getId() : null; Objects.requireNonNull(taskId, "taskId must be provided"); new GetHistoricEntityLinkParentsForTaskCmd(taskId);
Defensive patterns
Strategy: validation
Validate before calling
if (taskId == null) { throw new IllegalArgumentException("taskId must be provided"); } Type guard
boolean hasTaskId = t != null && t.getId() != null;
Try / catch
try { ... } catch (FlowableIllegalArgumentException e) { throw new BadRequestException("taskId is required"); } Prevention
- Use DelegateTask.getId() rather than cached nullable fields
- Validate the id before constructing commands
- Ensure task context is available in delegates/listeners
When it happens
Trigger: Constructing the command with a null taskId, typically when the id is read from a nullable source (DelegateTask absent, missing path variable, null map value).
Common situations: Listeners/delegates running outside task scope, wrong variable used for the id, REST layer dropping the task id.
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
- caseInstanceId is required
- taskId is required
- caseInstanceId is required
- caseInstanceId is required
- caseInstanceId is required
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/9bd7b78d862ad71b.
Report an issue: GitHub.