{"record":{"id":"da38375ecd429398","repo":"flowable/flowable-engine","slug":"process-definition-id-is-null-da3837","errorCode":null,"errorMessage":"process definition id is null","messagePattern":"process definition id is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetProcessDefinitionInfoCmd.java","lineNumber":45,"sourceCode":"import tools.jackson.databind.node.ObjectNode;\n\n/**\n * @author Tijs Rademakers\n */\npublic class GetProcessDefinitionInfoCmd implements Command<ObjectNode>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String processDefinitionId;\n\n    public GetProcessDefinitionInfoCmd(String processDefinitionId) {\n        this.processDefinitionId = processDefinitionId;\n    }\n\n    @Override\n    public ObjectNode execute(CommandContext commandContext) {\n        if (processDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"process definition id is null\");\n        }\n\n        ObjectNode resultNode = null;\n        DeploymentManager deploymentManager = CommandContextUtil.getProcessEngineConfiguration(commandContext).getDeploymentManager();\n        // make sure the process definition is in the cache\n        ProcessDefinition processDefinition = deploymentManager.findDeployedProcessDefinitionById(processDefinitionId);\n        if (Flowable5Util.isFlowable5ProcessDefinition(processDefinition, commandContext)) {\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n            return compatibilityHandler.getProcessDefinitionInfo(processDefinitionId);\n        }\n\n        ProcessDefinitionInfoCacheObject definitionInfoCacheObject = deploymentManager.getProcessDefinitionInfoCache().get(processDefinitionId);\n        if (definitionInfoCacheObject != null) {\n            resultNode = definitionInfoCacheObject.getInfoNode();\n        }\n\n        return resultNode;\n    }","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetProcessDefinitionInfoCmd.java#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Null-check the id before the call and raise a meaningful error","Resolve the id from a reliable source: repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult().getId()","Validate REST path parameters before invoking the service","Inspect the upstream execution/variable lookup that yielded null"],"exampleFix":"// before\nObjectNode info = (ObjectNode) runtimeService.getProcessDefinitionInfo(defId); // defId may be null\n// after\nif (defId == null) {\n    defId = repositoryService.createProcessDefinitionQuery()\n        .processDefinitionKey(\"myProcess\").latestVersion().singleResult().getId();\n}\nObjectNode info = (ObjectNode) runtimeService.getProcessDefinitionInfo(defId);","handlingStrategy":"validation","validationCode":"if (processDefinitionId == null || processDefinitionId.isEmpty()) {\n  throw new IllegalArgumentException(\"process definition id is required\");\n}","typeGuard":"boolean hasDefinitionId(String id) { return id != null && !id.isEmpty(); }","tryCatchPattern":"try {\n  ObjectNode info = (ObjectNode) runtimeService.getProcessDefinitionInfo(defId);\n} catch (FlowableIllegalArgumentException e) {\n  throw new IllegalArgumentException(\"Supply a valid process definition id\", e);\n}","preventionTips":["Resolve the id from a definition query when it comes from optional variables","Validate REST path parameters before calling the service","Check execution variables for the definition id before dynamic-process calls"],"tags":["flowable","null-argument","process-definition","validation"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}