{"record":{"id":"9bd7b78d862ad71b","repo":"flowable/flowable-engine","slug":"taskid-is-required-9bd7b7","errorCode":null,"errorMessage":"taskId is required","messagePattern":"taskId is required","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricEntityLinkParentsForTaskCmd.java","lineNumber":34,"sourceCode":"import java.util.List;\n\nimport org.flowable.cmmn.engine.CmmnEngineConfiguration;\nimport org.flowable.cmmn.engine.impl.util.CommandContextUtil;\nimport org.flowable.common.engine.api.FlowableIllegalArgumentException;\nimport 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.entitylink.api.EntityLinkType;\nimport org.flowable.entitylink.api.history.HistoricEntityLink;\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        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        return cmmnEngineConfiguration.getEntityLinkServiceConfiguration().getHistoricEntityLinkService()\n                .findHistoricEntityLinksByReferenceScopeIdAndType(taskId, ScopeTypes.TASK, EntityLinkType.CHILD);\n    }\n\n}\n","sourceCodeStart":16,"sourceCodeEnd":47,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricEntityLinkParentsForTaskCmd.java#L16-L47","documentation":"GetHistoricEntityLinkParentsForTaskCmd returns the historic entity link parents of a task. Its constructor throws FlowableIllegalArgumentException when taskId is null, consistent with Flowable's constructor-level null checks for command objects.","triggerScenarios":"Constructing the command with a null taskId, typically when the id is read from a nullable source (DelegateTask absent, missing path variable, null map value).","commonSituations":"Listeners/delegates running outside task scope, wrong variable used for the id, REST layer dropping the task id.","solutions":["Pass a non-null taskId to the command.","Capture DelegateTask.getId() inside task-scoped listeners instead of a nullable field.","Validate the id before invoking the history service."],"exampleFix":"// before\nnew GetHistoricEntityLinkParentsForTaskCmd(taskInfo.getId());\n// after\nString taskId = taskInfo != null ? taskInfo.getId() : null;\nObjects.requireNonNull(taskId, \"taskId must be provided\");\nnew GetHistoricEntityLinkParentsForTaskCmd(taskId);","handlingStrategy":"validation","validationCode":"if (taskId == null) { throw new IllegalArgumentException(\"taskId must be provided\"); }","typeGuard":"boolean hasTaskId = t != null && t.getId() != null;","tryCatchPattern":"try { ... } catch (FlowableIllegalArgumentException e) { throw new BadRequestException(\"taskId is required\"); }","preventionTips":["Use DelegateTask.getId() rather than cached nullable fields","Validate the id before constructing commands","Ensure task context is available in delegates/listeners"],"tags":["flowable","cmmn","null-argument","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}