flowable/flowable-engine · error · FlowableIllegalArgumentException

deploymentId is null

Error message

deploymentId is null

What it means

GetDeploymentResourceCmd streams a resource (e.g. an event model XML) from a deployed event deployment. If deploymentId is null the command cannot locate anything and throws FlowableIllegalArgumentException immediately before any lookup. It protects the resource entity manager from a pointless null-keyed query.

Source

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

/**
 * @author Joram Barrez
 */
public class GetDeploymentResourceCmd implements Command<InputStream>, Serializable {

    private static final long serialVersionUID = 1L;
    protected String deploymentId;
    protected String resourceName;

    public GetDeploymentResourceCmd(String deploymentId, String resourceName) {
        this.deploymentId = deploymentId;
        this.resourceName = resourceName;
    }

    @Override
    public InputStream execute(CommandContext commandContext) {
        if (deploymentId == null) {
            throw new FlowableIllegalArgumentException("deploymentId is null");
        }
        if (resourceName == null) {
            throw new FlowableIllegalArgumentException("resourceName is null");
        }

        EventResourceEntity resource = CommandContextUtil.getResourceEntityManager().findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
        if (resource == null) {
            if (CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId) == null) {
                throw new FlowableObjectNotFoundException("deployment does not exist: " + deploymentId);
            } else {
                throw new FlowableObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'");
            }
        }
        return new ByteArrayInputStream(resource.getBytes());
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a valid deploymentId obtained from the EventDeployment returned by repositoryService/EventRepositoryService.createDeployment().deploy()
  2. Guard the caller: only execute the command when deploymentId != null
  3. Trace where the null id originates (e.g. executeActivityBehavior) and fix the upstream resolution

Example fix

// before
InputStream is = managementService.executeCommand(new GetDeploymentResourceCmd(deploymentId, "my.model.json")); // deploymentId null
// after
if (deploymentId == null) {
    throw new IllegalStateException("deploymentId must be resolved before fetching resources");
}
InputStream is = managementService.executeCommand(new GetDeploymentResourceCmd(deploymentId, "my.model.json"));
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

boolean hasDeploymentId = deploymentId != null && !deploymentId.trim().isEmpty();

Try / catch

try {
    InputStream is = cmd.execute(commandContext);
} catch (FlowableIllegalArgumentException e) {
    log.error("Missing deploymentId: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Executing GetDeploymentResourceCmd(null, resourceName) directly, or via the behavior layer (executeActivityBehavior) where the deploymentId was resolved from a null deployment property.

Common situations: Programmatic deployment resource fetch where the deployment id variable was never populated; process/config model that omitted the deployment reference; result of a failed deploy call whose returned id was ignored.

Related errors


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