{"record":{"id":"a71222582ac535b2","repo":"flowable/flowable-engine","slug":"taskid-is-required-a71222","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/GetEntityLinkParentsForTaskCmd.java","lineNumber":40,"sourceCode":"import org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;\nimport org.flowable.engine.impl.persistence.entity.ExecutionEntity;\nimport org.flowable.engine.impl.util.CommandContextUtil;\nimport org.flowable.entitylink.api.EntityLink;\nimport org.flowable.entitylink.api.EntityLinkType;\nimport org.flowable.task.service.impl.persistence.entity.TaskEntity;\n\n/**\n * @author Javier Casal\n */\npublic class GetEntityLinkParentsForTaskCmd implements Command<List<EntityLink>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String taskId;\n\n    public GetEntityLinkParentsForTaskCmd(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<EntityLink> execute(CommandContext commandContext) {\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        TaskEntity task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);\n\n        if (task == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find task with id \" + taskId, ExecutionEntity.class);\n        }\n\n        return processEngineConfiguration.getEntityLinkServiceConfiguration().getEntityLinkService()\n                .findEntityLinksByReferenceScopeIdAndType(task.getId(), ScopeTypes.TASK, EntityLinkType.CHILD);\n    }\n\n}","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEntityLinkParentsForTaskCmd.java#L22-L58","documentation":"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.","triggerScenarios":"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).","commonSituations":"Task id field missing from a request DTO; a previous lookup returning null and the null being passed downstream; deserialization skipping the id property.","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."],"exampleFix":"// before\nruntimeService.getEntityLinkParentsForTask(taskId); // taskId may be null\n// after\nObjects.requireNonNull(taskId, \"taskId is required\");\nruntimeService.getEntityLinkParentsForTask(taskId);","handlingStrategy":"validation","validationCode":"if (taskId == null || taskId.isBlank()) {\n    throw new IllegalArgumentException(\"taskId is required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    taskService.getEntityLinkParentsForTask(taskId);\n} catch (FlowableIllegalArgumentException e) {\n    // caller bug: null taskId; reject at request-validation layer\n}","preventionTips":["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"],"tags":["flowable","null-argument","task","validation"],"backgroundTag":"null-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"}