flowable/flowable-engine · error · FlowableIllegalArgumentException

caseInstanceId is required

Error message

caseInstanceId is required

What it means

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.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetHistoricEntityLinkParentsForCaseInstanceCmd.java:38

import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.api.scope.ScopeTypes;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.entitylink.api.EntityLinkType;
import org.flowable.entitylink.api.history.HistoricEntityLink;

/**
 * @author Javier Casal
 */
public class GetHistoricEntityLinkParentsForCaseInstanceCmd implements Command<List<HistoricEntityLink>>, Serializable {

    private static final long serialVersionUID = 1L;
    
    protected String caseInstanceId;

    public GetHistoricEntityLinkParentsForCaseInstanceCmd(String caseInstanceId) {
        if (caseInstanceId == null) {
            throw new FlowableIllegalArgumentException("caseInstanceId is required");
        }
        this.caseInstanceId = caseInstanceId;
    }

    @Override
    public List<HistoricEntityLink> execute(CommandContext commandContext) {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        return cmmnEngineConfiguration.getEntityLinkServiceConfiguration().getHistoricEntityLinkService()
                .findHistoricEntityLinksByReferenceScopeIdAndType(caseInstanceId, ScopeTypes.CMMN, EntityLinkType.CHILD);
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Provide a valid caseInstanceId before building the command.
  2. Guard the traversal: skip parent-link lookup when the entity has no case instance id.
  3. Validate the id at the entry point of your service layer.

Example fix

// before
new GetHistoricEntityLinkParentsForCaseInstanceCmd(instance.getCaseInstanceId());
// after
if (instance.getCaseInstanceId() == null) {
    return Collections.emptyList();
}
new GetHistoricEntityLinkParentsForCaseInstanceCmd(instance.getCaseInstanceId());
Defensive patterns

Strategy: validation

Validate before calling

if (entity.getCaseInstanceId() == null) { return Collections.emptyList(); }

Type guard

boolean hasParentLookup = c != null && c.getCaseInstanceId() != null;

Try / catch

try { ... } catch (FlowableIllegalArgumentException e) { return Collections.emptyList(); }

Prevention

When it happens

Trigger: Calling new GetHistoricEntityLinkParentsForCaseInstanceCmd(null) or an API path forwarding a null id resolved from a variable, map lookup, or absent request parameter.

Common situations: Hierarchy traversal code that starts from an entity with no case instance id set (e.g. standalone task), null propagation from prior failed lookups.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/9dc4d164c03f9e81. Report an issue: GitHub.