{"record":{"id":"8f6b6686a88dc495","repo":"flowable/flowable-engine","slug":"taskid-is-required-8f6b66","errorCode":null,"errorMessage":"taskId is required","messagePattern":"taskId is required","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetHistoricEntityLinkChildrenForTaskCmd.java","lineNumber":37,"sourceCode":"import org.flowable.common.engine.api.scope.ScopeTypes;\nimport org.flowable.common.engine.impl.interceptor.Command;\nimport org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;\nimport org.flowable.engine.impl.util.CommandContextUtil;\nimport org.flowable.entitylink.api.EntityLinkType;\nimport org.flowable.entitylink.api.history.HistoricEntityLink;\n\n/**\n * @author Javier Casal\n */\npublic class GetHistoricEntityLinkChildrenForTaskCmd implements Command<List<HistoricEntityLink>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String taskId;\n\n    public GetHistoricEntityLinkChildrenForTaskCmd(String taskId) {\n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"taskId is required\");\n        }\n        this.taskId = taskId;\n    }\n\n    @Override\n    public List<HistoricEntityLink> execute(CommandContext commandContext) {\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        return processEngineConfiguration.getEntityLinkServiceConfiguration().getHistoricEntityLinkService()\n                .findHistoricEntityLinksByScopeIdAndScopeType(taskId, ScopeTypes.TASK, EntityLinkType.CHILD);\n    }\n\n}\n","sourceCodeStart":19,"sourceCodeEnd":50,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetHistoricEntityLinkChildrenForTaskCmd.java#L19-L50","documentation":"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.","triggerScenarios":"new GetHistoricEntityLinkChildrenForTaskCmd(null) — usually when a task lookup (runtime or historic) returned null and its id was passed on without a check.","commonSituations":"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.","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."],"exampleFix":"// before\nhistoryService.findHistoricEntityLinkChildrenForTask(taskId);\n// after\nif (taskId == null) {\n    return Collections.emptyList();\n}\nhistoryService.findHistoricEntityLinkChildrenForTask(taskId);","handlingStrategy":"validation","validationCode":"if (taskId == null) { return Collections.emptyList(); }","typeGuard":null,"tryCatchPattern":"try {\n    return historyService.findHistoricEntityLinkChildrenForTask(taskId);\n} catch (FlowableIllegalArgumentException e) {\n    return Collections.emptyList();\n}","preventionTips":["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"],"tags":["flowable","argument-validation","entity-links","task"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}