flowable/flowable-engine · error · FlowableIllegalArgumentException

deploymentId is null

Error message

deploymentId is null

What it means

GetDeploymentResourceCmd validates both required inputs before querying the CmmnResourceEntityManager. When deploymentId is null it throws FlowableIllegalArgumentException('deploymentId is null'); resourceName null produces the sibling error. The command needs both to locate the exact resource bytes within a deployment.

Source

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

import org.flowable.common.engine.impl.interceptor.CommandContext;

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

    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");
        }

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

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Obtain a valid deploymentId from the deployment query before fetching the resource
  2. Handle the case where the deployment query returns no result instead of passing a null id
  3. Validate deploymentId (and resourceName) non-null before the API call

Example fix

// before
Deployment dep = repositoryService.createDeploymentQuery().deploymentName(name).singleResult();
InputStream res = repositoryService.getResource(dep.getId(), resource); // NPE risk / null id
// after
Deployment dep = repositoryService.createDeploymentQuery().deploymentName(name).singleResult();
if (dep != null) {
    InputStream res = repositoryService.getResource(dep.getId(), resource);
}
Defensive patterns

Strategy: validation

Validate before calling

Objects.requireNonNull(deploymentId, "deploymentId is required");
Objects.requireNonNull(resourceName, "resourceName is required");

Type guard

boolean canFetchResource = deploymentId != null && resourceName != null;

Try / catch

try { return repositoryService.getResource(deploymentId, resourceName); } catch (FlowableIllegalArgumentException e) { log.error("Bad getResource args: {}", e.getMessage()); throw e; }

Prevention

When it happens

Trigger: repositoryService.getResource(deploymentId, resourceName) (CMMN repository service) called with a null deploymentId — e.g. deployment lookup failed upstream and its result was passed along, or the deployment id field was never set.

Common situations: Chain like createDeploymentQuery().singleResult() returning null and .getId() being replaced by a null variable; integration code skipping the deployment step; multi-tenant lookup that filtered out the deployment.

Related errors


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