flowable/flowable-engine · error · FlowableIllegalArgumentException

process definition id is null

Error message

process definition id is null

What it means

GetProcessDefinitionInfoCmd.execute throws FlowableIllegalArgumentException('process definition id is null') when the processDefinitionId constructor argument is null. The command reads the definition's model info (diagram/feature info from the deployed model), so it must know which definition to load. Fail-fast validation before contacting the DeploymentManager.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetProcessDefinitionInfoCmd.java:45

import tools.jackson.databind.node.ObjectNode;

/**
 * @author Tijs Rademakers
 */
public class GetProcessDefinitionInfoCmd implements Command<ObjectNode>, Serializable {

    private static final long serialVersionUID = 1L;

    protected String processDefinitionId;

    public GetProcessDefinitionInfoCmd(String processDefinitionId) {
        this.processDefinitionId = processDefinitionId;
    }

    @Override
    public ObjectNode execute(CommandContext commandContext) {
        if (processDefinitionId == null) {
            throw new FlowableIllegalArgumentException("process definition id is null");
        }

        ObjectNode resultNode = null;
        DeploymentManager deploymentManager = CommandContextUtil.getProcessEngineConfiguration(commandContext).getDeploymentManager();
        // make sure the process definition is in the cache
        ProcessDefinition processDefinition = deploymentManager.findDeployedProcessDefinitionById(processDefinitionId);
        if (Flowable5Util.isFlowable5ProcessDefinition(processDefinition, commandContext)) {
            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();
            return compatibilityHandler.getProcessDefinitionInfo(processDefinitionId);
        }

        ProcessDefinitionInfoCacheObject definitionInfoCacheObject = deploymentManager.getProcessDefinitionInfoCache().get(processDefinitionId);
        if (definitionInfoCacheObject != null) {
            resultNode = definitionInfoCacheObject.getInfoNode();
        }

        return resultNode;
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Null-check the id before the call and raise a meaningful error
  2. Resolve the id from a reliable source: repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult().getId()
  3. Validate REST path parameters before invoking the service
  4. Inspect the upstream execution/variable lookup that yielded null

Example fix

// before
ObjectNode info = (ObjectNode) runtimeService.getProcessDefinitionInfo(defId); // defId may be null
// after
if (defId == null) {
    defId = repositoryService.createProcessDefinitionQuery()
        .processDefinitionKey("myProcess").latestVersion().singleResult().getId();
}
ObjectNode info = (ObjectNode) runtimeService.getProcessDefinitionInfo(defId);
Defensive patterns

Strategy: validation

Validate before calling

if (processDefinitionId == null || processDefinitionId.isEmpty()) {
  throw new IllegalArgumentException("process definition id is required");
}

Type guard

boolean hasDefinitionId(String id) { return id != null && !id.isEmpty(); }

Try / catch

try {
  ObjectNode info = (ObjectNode) runtimeService.getProcessDefinitionInfo(defId);
} catch (FlowableIllegalArgumentException e) {
  throw new IllegalArgumentException("Supply a valid process definition id", e);
}

Prevention

When it happens

Trigger: Calling RuntimeService.getProcessDefinitionInfo(processDefinitionId) (or the command directly) with a null id — typically a variable that was never set, or an earlier query/singleResult that returned null and its getId() path was skipped.

Common situations: Dynamic process / app-engine code that resolves the definition id from execution variables which were absent; REST calls missing the path parameter mapped to null; tests constructing the command with null.

Related errors


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