flowable/flowable-engine · error · FlowableIllegalArgumentException
taskId is required
Error message
taskId is required
What it means
The GetEntityLinkParentsForTaskCmd constructor rejects a null taskId immediately with FlowableIllegalArgumentException. Flowable requires a concrete task id to look up parent entity links, so constructing the command with null is invalid by contract.
Source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEntityLinkParentsForTaskCmd.java:40
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
import org.flowable.engine.impl.util.CommandContextUtil;
import org.flowable.entitylink.api.EntityLink;
import org.flowable.entitylink.api.EntityLinkType;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
/**
* @author Javier Casal
*/
public class GetEntityLinkParentsForTaskCmd implements Command<List<EntityLink>>, Serializable {
private static final long serialVersionUID = 1L;
protected String taskId;
public GetEntityLinkParentsForTaskCmd(String taskId) {
if (taskId == null) {
throw new FlowableIllegalArgumentException("taskId is required");
}
this.taskId = taskId;
}
@Override
public List<EntityLink> execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
TaskEntity task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);
if (task == null) {
throw new FlowableObjectNotFoundException("Cannot find task with id " + taskId, ExecutionEntity.class);
}
return processEngineConfiguration.getEntityLinkServiceConfiguration().getEntityLinkService()
.findEntityLinksByReferenceScopeIdAndType(task.getId(), ScopeTypes.TASK, EntityLinkType.CHILD);
}
}View on GitHub (pinned to d6d39ce1c6)
Solutions
- Null-check taskId before invoking the service method or constructing the command.
- Ensure upstream code populated the task id (from TaskEntity.getId() or the API request).
- Return a client-side validation error (400) when the id field is absent instead of reaching the engine.
- Use Optional/Objects.requireNonNull at your service boundary to fail fast with a clear message.
Example fix
// before runtimeService.getEntityLinkParentsForTask(taskId); // taskId may be null // after Objects.requireNonNull(taskId, "taskId is required"); runtimeService.getEntityLinkParentsForTask(taskId);
Defensive patterns
Strategy: validation
Validate before calling
if (taskId == null || taskId.isBlank()) {
throw new IllegalArgumentException("taskId is required");
} Try / catch
try {
taskService.getEntityLinkParentsForTask(taskId);
} catch (FlowableIllegalArgumentException e) {
// caller bug: null taskId; reject at request-validation layer
} Prevention
- Null-check ids at API/DTO boundary
- Use Objects.requireNonNull early
- Populate taskId from TaskEntity.getId() directly
- Reject blank/missing id fields in request validation
When it happens
Trigger: new GetEntityLinkParentsForTaskCmd(null) or calling TaskService/RuntimeService wrapper methods that construct this command when the caller's taskId variable is null (e.g. from an unbound delegation or missing task payload).
Common situations: Task id field missing from a request DTO; a previous lookup returning null and the null being passed downstream; deserialization skipping the id property.
Related errors
- task is null
- Error retrieving app engine info
- No deployment id available
- No resource name available
- appsDefinitionIds is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/a71222582ac535b2.
Report an issue: GitHub.