{"record":{"id":"3fdc8fe2d1e32443","repo":"flowable/flowable-engine","slug":"planiteminstanceid-is-required","errorCode":null,"errorMessage":"planItemInstanceId is required","messagePattern":"planItemInstanceId is required","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricIdentityLinksForPlanItemInstanceCmd.java","lineNumber":37,"sourceCode":"import 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.identitylink.api.history.HistoricIdentityLink;\n\n/**\n * @author Tijs Rademakers\n */\npublic class GetHistoricIdentityLinksForPlanItemInstanceCmd implements Command<List<HistoricIdentityLink>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    \n    protected String planItemInstanceId;\n\n    public GetHistoricIdentityLinksForPlanItemInstanceCmd(String planItemInstanceId) {\n        if (planItemInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"planItemInstanceId is required\");\n        }\n        this.planItemInstanceId = planItemInstanceId;\n    }\n\n    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n    @Override\n    public List<HistoricIdentityLink> execute(CommandContext commandContext) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        return (List) cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getHistoricIdentityLinkService()\n                .findHistoricIdentityLinksBySubScopeIdAndScopeType(planItemInstanceId, ScopeTypes.PLAN_ITEM);\n    }\n\n}\n","sourceCodeStart":19,"sourceCodeEnd":51,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricIdentityLinksForPlanItemInstanceCmd.java#L19-L51","documentation":"GetHistoricIdentityLinksForPlanItemInstanceCmd fetches historic identity links for a plan item instance. Its constructor throws FlowableIllegalArgumentException when planItemInstanceId is null, per Flowable's uniform constructor validation for commands.","triggerScenarios":"Constructing the command with a null planItemInstanceId, or forwarding a null from a delegate/variable lookup inside a case execution.","commonSituations":"Plan-item-scoped listeners that read the id from the wrong scope, confusing planItemInstanceId with caseInstanceId or task id.","solutions":["Pass a valid non-null planItemInstanceId (e.g. DelegatePlanItemInstance.getId() in listeners).","Validate the id before invoking the history API.","Check you are not mixing up plan item id with stage or case instance id."],"exampleFix":"// before\nnew GetHistoricIdentityLinksForPlanItemInstanceCmd(variables.get(\"planItemInstanceId\"));\n// after\nString id = (String) variables.get(\"planItemInstanceId\");\nObjects.requireNonNull(id, \"planItemInstanceId must be provided\");\nnew GetHistoricIdentityLinksForPlanItemInstanceCmd(id);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(planItemInstanceId, \"planItemInstanceId must be provided\");","typeGuard":"boolean hasPlanItemId = p != null && p.getId() != null;","tryCatchPattern":"try { ... } catch (FlowableIllegalArgumentException e) { throw new BadRequestException(\"planItemInstanceId is required\"); }","preventionTips":["Use DelegatePlanItemInstance.getId() in plan item listeners","Do not confuse planItemInstanceId with caseInstanceId or taskId","Validate ids before engine calls"],"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-18T11:17:12.947Z"}