flowable/flowable-engine · error · FlowableIllegalArgumentException

taskId is required

Error message

taskId is required

What it means

The GetHistoricEntityLinkParentsForTaskCmd constructor requires a taskId and throws FlowableIllegalArgumentException when it is null. The command returns the historic entity-link ancestors of a task, which requires the task id to look them up.

Solutions

  1. Confirm the task id exists (runtime or historic task query) before requesting its parent entity links.
  2. Null-check at the call site and return an empty list or skip the lookup.
  3. Pass the actual task id (Task.getId()), not related execution or process ids.

Example fix

// before
historyService.findHistoricEntityLinkParentsForTask(taskId);
// after
if (taskId == null) {
    return Collections.emptyList();
}
historyService.findHistoricEntityLinkParentsForTask(taskId);
Defensive patterns

Strategy: validation

Validate before calling

if (taskId == null) { return Collections.emptyList(); }

Try / catch

try {
    return historyService.findHistoricEntityLinkParentsForTask(taskId);
} catch (FlowableIllegalArgumentException e) {
    return Collections.emptyList();
}

Prevention

When it happens

Trigger: new GetHistoricEntityLinkParentsForTaskCmd(null) — usually when a task query returned no result and the null was forwarded, or the variable holding the task id was never populated.

Common situations: Post-completion lookups where the task was deleted from history; passing an execution id or process instance id where a task id is expected; generic task-listener code invoked for non-process tasks.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/c564e5bbac091526. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetHistoricEntityLinkParentsForTaskCmd.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 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) {
        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
        return processEngineConfiguration.getEntityLinkServiceConfiguration().getHistoricEntityLinkService()
                .findHistoricEntityLinksByReferenceScopeIdAndType(taskId, ScopeTypes.TASK, EntityLinkType.CHILD);
    }

}

View on GitHub (pinned to d6d39ce1c6)