flowable/flowable-engine · error · FlowableIllegalArgumentException

The case definition id is mandatory, but '' has been provide

Error message

The case definition id is mandatory, but '' has been provided.

What it means

GetDeploymentCaseDiagramCmd enforces in its constructor that a caseDefinitionId is supplied: null or empty-string ids throw FlowableIllegalArgumentException with the offending value embedded in the message ('' for empty). Unlike the other commands, this validation happens at command construction time, so the exception is thrown before the command ever executes.

Source

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

import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Gives access to a deployed case diagram, e.g., a PNG image, through a stream of bytes.
 * 
 * @author Tijs Rademakers
 */
public class GetDeploymentCaseDiagramCmd implements Command<InputStream>, Serializable {

    private static final long serialVersionUID = 1L;
    private static final Logger LOGGER = LoggerFactory.getLogger(GetDeploymentCaseDiagramCmd.class);

    protected String caseDefinitionId;

    public GetDeploymentCaseDiagramCmd(String caseDefinitionId) {
        if (caseDefinitionId == null || caseDefinitionId.length() == 0) {
            throw new FlowableIllegalArgumentException("The case definition id is mandatory, but '" + caseDefinitionId + "' has been provided.");
        }
        this.caseDefinitionId = caseDefinitionId;
    }

    @Override
    public InputStream execute(CommandContext commandContext) {
        CaseDefinition caseDefinition = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getDeploymentManager().findDeployedCaseDefinitionById(caseDefinitionId);
        String deploymentId = caseDefinition.getDeploymentId();
        String resourceName = caseDefinition.getDiagramResourceName();
        if (resourceName == null) {
            LOGGER.info("Resource name is null! No case diagram stream exists.");
            return null;
        } else {
            InputStream caseDiagramStream = new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
            return caseDiagramStream;
        }
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a non-null, non-empty caseDefinitionId when constructing the command
  2. Trim and validate the id at the caller boundary (reject empty strings, not just null)
  3. Resolve the id from the case definition query before requesting the diagram

Example fix

// before
InputStream diagram = repositoryService.getCaseDiagram(caseDefinitionId); // id may be ""
// after
if (caseDefinitionId == null || caseDefinitionId.trim().isEmpty()) {
    throw new IllegalArgumentException("caseDefinitionId is required");
}
InputStream diagram = repositoryService.getCaseDiagram(caseDefinitionId);
Defensive patterns

Strategy: validation

Validate before calling

if (id == null || id.trim().isEmpty()) { throw new IllegalArgumentException("caseDefinitionId required"); }

Type guard

boolean isNonEmptyId = s != null && !s.trim().isEmpty();

Try / catch

try { return repositoryService.getCaseDiagram(id); } catch (FlowableIllegalArgumentException e) { log.error("Invalid id '{}': {}", id, e.getMessage()); throw e; }

Prevention

When it happens

Trigger: new GetDeploymentCaseDiagramCmd(null) or new GetDeploymentCaseDiagramCmd("") — typically via repositoryService.getCaseDiagramResource/case diagram APIs fed an empty id variable.

Common situations: Empty string from a request parameter defaulting to "" instead of null; trimmed-to-empty user input; id variable never populated in a template or script task.

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/dd18623155833559. Report an issue: GitHub.