{"record":{"id":"a0bcf25666b2e6d8","repo":"flowable/flowable-engine","slug":"caseinstanceid-is-required-a0bcf2","errorCode":null,"errorMessage":"caseInstanceId is required","messagePattern":"caseInstanceId is required","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricEntityLinkChildrenWithSameRootAsCaseInstanceCmd.java","lineNumber":35,"sourceCode":"import 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\n/**\n * @author Filip Hrisafov\n */\npublic class GetHistoricEntityLinkChildrenWithSameRootAsCaseInstanceCmd implements Command<List<HistoricEntityLink>> {\n    \n    protected String caseInstanceId;\n\n    public GetHistoricEntityLinkChildrenWithSameRootAsCaseInstanceCmd(String caseInstanceId) {\n        if (caseInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"caseInstanceId is required\");\n        }\n        this.caseInstanceId = caseInstanceId;\n    }\n\n    @Override\n    public List<HistoricEntityLink> execute(CommandContext commandContext) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        return cmmnEngineConfiguration.getEntityLinkServiceConfiguration().getHistoricEntityLinkService()\n                .findHistoricEntityLinksWithSameRootScopeForScopeIdAndScopeType(caseInstanceId, ScopeTypes.CMMN, EntityLinkType.CHILD);\n    }\n\n}\n","sourceCodeStart":17,"sourceCodeEnd":48,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricEntityLinkChildrenWithSameRootAsCaseInstanceCmd.java#L17-L48","documentation":"GetHistoricEntityLinkChildrenWithSameRootAsCaseInstanceCmd retrieves historic entity links for a case instance that share the same root entity. Its constructor throws FlowableIllegalArgumentException when caseInstanceId is null since the root-scoped query is meaningless without it.","triggerScenarios":"Constructing the command with a null caseInstanceId, or a service wrapper that resolves the id from a nullable variable/expression and forwards null.","commonSituations":"Root/parent hierarchy lookups where the caller confused caseInstanceId with root entity id, or a null returned by a previous engine query.","solutions":["Pass a valid non-null caseInstanceId when constructing the command.","Check the source of the id (variable, map, request) and fail with a clear message before engine invocation.","Confirm you are using the right id type (case instance id, not plan item or task id)."],"exampleFix":"// before\nnew GetHistoricEntityLinkChildrenWithSameRootAsCaseInstanceCmd(ctx.getVariable(\"caseInstanceId\"));\n// after\nString caseInstanceId = (String) ctx.getVariable(\"caseInstanceId\");\nObjects.requireNonNull(caseInstanceId, \"caseInstanceId must be provided\");\nnew GetHistoricEntityLinkChildrenWithSameRootAsCaseInstanceCmd(caseInstanceId);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(caseInstanceId, \"caseInstanceId must be provided\");","typeGuard":"boolean validId = id instanceof String && !((String) id).isEmpty();","tryCatchPattern":"try { ... } catch (FlowableIllegalArgumentException e) { log.warn(\"Missing caseInstanceId\"); return Collections.emptyList(); }","preventionTips":["Confirm the id source variable actually holds the case instance id","Fail fast with requireNonNull at composition sites","Do not forward nullable lookup results into commands"],"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"}