{"record":{"id":"9dc4d164c03f9e81","repo":"flowable/flowable-engine","slug":"caseinstanceid-is-required-9dc4d1","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/GetHistoricEntityLinkParentsForCaseInstanceCmd.java","lineNumber":38,"sourceCode":"import 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 Javier Casal\n */\npublic class GetHistoricEntityLinkParentsForCaseInstanceCmd implements Command<List<HistoricEntityLink>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    \n    protected String caseInstanceId;\n\n    public GetHistoricEntityLinkParentsForCaseInstanceCmd(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                .findHistoricEntityLinksByReferenceScopeIdAndType(caseInstanceId, ScopeTypes.CMMN, EntityLinkType.CHILD);\n    }\n\n}\n","sourceCodeStart":20,"sourceCodeEnd":51,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricEntityLinkParentsForCaseInstanceCmd.java#L20-L51","documentation":"GetHistoricEntityLinkParentsForCaseInstanceCmd fetches the historic entity link parents of a case instance. The constructor throws FlowableIllegalArgumentException when caseInstanceId is null, applying Flowable's standard fail-fast argument validation before the command executes.","triggerScenarios":"Calling new GetHistoricEntityLinkParentsForCaseInstanceCmd(null) or an API path forwarding a null id resolved from a variable, map lookup, or absent request parameter.","commonSituations":"Hierarchy traversal code that starts from an entity with no case instance id set (e.g. standalone task), null propagation from prior failed lookups.","solutions":["Provide a valid caseInstanceId before building the command.","Guard the traversal: skip parent-link lookup when the entity has no case instance id.","Validate the id at the entry point of your service layer."],"exampleFix":"// before\nnew GetHistoricEntityLinkParentsForCaseInstanceCmd(instance.getCaseInstanceId());\n// after\nif (instance.getCaseInstanceId() == null) {\n    return Collections.emptyList();\n}\nnew GetHistoricEntityLinkParentsForCaseInstanceCmd(instance.getCaseInstanceId());","handlingStrategy":"validation","validationCode":"if (entity.getCaseInstanceId() == null) { return Collections.emptyList(); }","typeGuard":"boolean hasParentLookup = c != null && c.getCaseInstanceId() != null;","tryCatchPattern":"try { ... } catch (FlowableIllegalArgumentException e) { return Collections.emptyList(); }","preventionTips":["Skip hierarchy lookups for entities without a case instance id","Validate ids before building commands","Log the calling context when ids can be legitimately absent"],"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"}