{"record":{"id":"c564e5bbac091526","repo":"flowable/flowable-engine","slug":"taskid-is-required-c564e5","errorCode":null,"errorMessage":"taskId is required","messagePattern":"taskId is required","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetHistoricEntityLinkParentsForTaskCmd.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 GetHistoricEntityLinkParentsForTaskCmd implements Command<List<HistoricEntityLink>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String taskId;\n\n    public GetHistoricEntityLinkParentsForTaskCmd(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                .findHistoricEntityLinksByReferenceScopeIdAndType(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/GetHistoricEntityLinkParentsForTaskCmd.java#L19-L50","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the task id exists (runtime or historic task query) before requesting its parent entity links.","Null-check at the call site and return an empty list or skip the lookup.","Pass the actual task id (Task.getId()), not related execution or process ids."],"exampleFix":"// before\nhistoryService.findHistoricEntityLinkParentsForTask(taskId);\n// after\nif (taskId == null) {\n    return Collections.emptyList();\n}\nhistoryService.findHistoricEntityLinkParentsForTask(taskId);","handlingStrategy":"validation","validationCode":"if (taskId == null) { return Collections.emptyList(); }","typeGuard":null,"tryCatchPattern":"try {\n    return historyService.findHistoricEntityLinkParentsForTask(taskId);\n} catch (FlowableIllegalArgumentException e) {\n    return Collections.emptyList();\n}","preventionTips":["Guard lookups chained off potentially-empty task queries","Use Task.getId() as the only source of taskId for this API","Log and skip missing tasks instead of forwarding 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"}