flowable/flowable-engine · error · FlowableIllegalArgumentException

deploymentId is null

Error message

deploymentId is null

What it means

GetDeploymentResourceCmd.execute validates that a deploymentId was supplied and throws FlowableIllegalArgumentException when it is null. The deployment id is required to look up resources in the DMN engine's resource entity manager, so a null value cannot be meaningfully queried.

Source

Thrown at modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/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");
        }

        DmnResourceEntity 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 the actual deployment id string from dmnRepositoryService.createDeploymentQuery()...singleResult().getId()
  2. Check the preceding lookup that produced the id — if it returned null, handle that before calling getDeploymentResource
  3. Ensure arguments are in the right order: getDeploymentResource(deploymentId, resourceName)

Example fix

// before
Deployment d = repoService.createDeploymentQuery().deploymentName(name).singleResult();
repoService.getDeploymentResource(d.getId(), resource); // NPE/null id if d == null
// after
Deployment d = repoService.createDeploymentQuery().deploymentName(name).singleResult();
if (d == null) throw new IllegalStateException("no deployment named " + name);
repoService.getDeploymentResource(d.getId(), resource);
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try { repoService.getDeploymentResource(depId, name); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().equals("deploymentId is null")) { throw new ConfigurationException("deployment id missing", e); } throw e; }

Prevention

When it happens

Trigger: dmnRepositoryService.getDeploymentResource(null, resourceName) or building GetDeploymentResourceCmd without a deployment id — commonly the id is read from a Deployment object/variable that is null.

Common situations: Looking up the deployment id by name/key first and that lookup returned null; passing an entity's id before the entity was persisted; wiring error where a different variable is passed in the first argument slot.

Related errors


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