flowable/flowable-engine · error · FlowableIllegalArgumentException

Deployment id is null

Error message

Deployment id is null

What it means

SetDeploymentCategoryCmd.execute() validates the deploymentId argument; if null it throws FlowableIllegalArgumentException immediately. Setting a category requires an existing event deployment identified by id.

Source

Thrown at modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/SetDeploymentCategoryCmd.java:39

/**
 * @author Tijs Rademakers
 */
public class SetDeploymentCategoryCmd implements Command<Void> {

    protected String deploymentId;
    protected String category;

    public SetDeploymentCategoryCmd(String deploymentId, String category) {
        this.deploymentId = deploymentId;
        this.category = category;
    }

    @Override
    public Void execute(CommandContext commandContext) {

        if (deploymentId == null) {
            throw new FlowableIllegalArgumentException("Deployment id is null");
        }

        EventDeploymentEntity deployment = CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId);

        if (deployment == null) {
            throw new FlowableObjectNotFoundException("No deployment found for id = '" + deploymentId + "'");
        }

        // Update category
        deployment.setCategory(category);
        CommandContextUtil.getDeploymentEntityManager(commandContext).update(deployment);

        return null;
    }

    public String getDeploymentId() {
        return deploymentId;
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Resolve the deployment id via a deployment query (e.g. eventRepositoryService.createDeploymentQuery()) before setting the category.
  2. Validate deploymentId != null in the calling code and fail with a clear message.
  3. Fix the upstream code/config that failed to supply the id.

Example fix

// before
eventRepositoryService.setDeploymentCategory(null, "events");
// after
EventDeployment dep = eventRepositoryService.createDeploymentQuery().deploymentName("myEvents").singleResult();
eventRepositoryService.setDeploymentCategory(dep.getId(), "events");
Defensive patterns

Strategy: validation

Validate before calling

if (deploymentId == null || deploymentId.isBlank()) {
    throw new IllegalArgumentException("deploymentId is required to set category");
}

Type guard

boolean hasDeploymentId(EventDeployment d) {
    return d != null && d.getId() != null;
}

Try / catch

try {
    eventRepositoryService.setDeploymentCategory(deploymentId, category);
} catch (FlowableIllegalArgumentException e) {
    log.error("deploymentId was null; resolve deployment first", e);
}

Prevention

When it happens

Trigger: Calling setDeploymentCategory (or constructing SetDeploymentCategoryCmd) with a null deployment id, typically from an unresolved lookup or unpopulated config value.

Common situations: A deployment query returned no results and the null was passed on; a variable shadowing bug; calling the API before any event deployments were made.

Related errors


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