flowable/flowable-engine · error · FlowableIllegalArgumentException
taskId is required
Error message
taskId is required
What it means
The GetHistoricEntityLinkChildrenForTaskCmd constructor requires a taskId and throws FlowableIllegalArgumentException when it is null. Historic entity links for a task (its children such as sub-tasks or related process instances) cannot be queried without the task id.
Solutions
- Resolve and verify the task id via taskService.createTaskQuery().taskId(id).singleResult() (or historyService) before querying entity links.
- Guard against null ids at the call site and return an empty result instead.
- Ensure you are passing a task id, not a process instance or execution id.
Example fix
// before
historyService.findHistoricEntityLinkChildrenForTask(taskId);
// after
if (taskId == null) {
return Collections.emptyList();
}
historyService.findHistoricEntityLinkChildrenForTask(taskId); Defensive patterns
Strategy: validation
Validate before calling
if (taskId == null) { return Collections.emptyList(); } Try / catch
try {
return historyService.findHistoricEntityLinkChildrenForTask(taskId);
} catch (FlowableIllegalArgumentException e) {
return Collections.emptyList();
} Prevention
- Resolve the task via a query and check for null before follow-up calls
- Distinguish task ids from process/execution ids in variable naming
- Handle tasks absent from history as 'no links' rather than passing null
When it happens
Trigger: new GetHistoricEntityLinkChildrenForTaskCmd(null) — usually when a task lookup (runtime or historic) returned null and its id was passed on without a check.
Common situations: Chaining calls after taskService.createTaskQuery().singleResult() that returned no row; tasks completed long ago and removed from history; using a processInstanceId where a taskId is expected.
Related errors
- taskId is required
- processInstanceId is required
- processInstanceId is required
- processInstanceId is required
- A delegated cannot be completed, but should be resolved…
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/8f6b6686a88dc495.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetHistoricEntityLinkChildrenForTaskCmd.java:37
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.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.entitylink.api.EntityLinkType;
import org.flowable.entitylink.api.history.HistoricEntityLink;
/**
* @author Javier Casal
*/
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) {
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
return processEngineConfiguration.getEntityLinkServiceConfiguration().getHistoricEntityLinkService()
.findHistoricEntityLinksByScopeIdAndScopeType(taskId, ScopeTypes.TASK, EntityLinkType.CHILD);
}
}
View on GitHub (pinned to d6d39ce1c6)