{"record":{"id":"968ace5e8cedc37d","repo":"flowable/flowable-engine","slug":"process-definition-id-is-null-968ace","errorCode":null,"errorMessage":"process definition id is null","messagePattern":"process definition id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SaveProcessDefinitionInfoCmd.java","lineNumber":46,"sourceCode":"/**\n * @author Tijs Rademakers\n */\npublic class SaveProcessDefinitionInfoCmd implements Command<Void>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String processDefinitionId;\n    protected ObjectNode infoNode;\n\n    public SaveProcessDefinitionInfoCmd(String processDefinitionId, ObjectNode infoNode) {\n        this.processDefinitionId = processDefinitionId;\n        this.infoNode = infoNode;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        if (processDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"process definition id is null\");\n        }\n\n        if (infoNode == null) {\n            throw new FlowableIllegalArgumentException(\"process definition info node is null\");\n        }\n\n        ProcessDefinitionInfoEntityManager definitionInfoEntityManager = CommandContextUtil.getProcessDefinitionInfoEntityManager(commandContext);\n        ProcessDefinitionInfoEntity definitionInfoEntity = definitionInfoEntityManager.findProcessDefinitionInfoByProcessDefinitionId(processDefinitionId);\n        if (definitionInfoEntity == null) {\n            definitionInfoEntity = definitionInfoEntityManager.create();\n            definitionInfoEntity.setProcessDefinitionId(processDefinitionId);\n            CommandContextUtil.getProcessDefinitionInfoEntityManager().insertProcessDefinitionInfo(definitionInfoEntity);\n        }\n\n        try {\n            ObjectWriter writer = CommandContextUtil.getProcessEngineConfiguration(commandContext).getObjectMapper().writer();\n            CommandContextUtil.getProcessDefinitionInfoEntityManager().updateInfoJson(definitionInfoEntity.getId(), writer.writeValueAsBytes(infoNode));\n        } catch (Exception e) {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SaveProcessDefinitionInfoCmd.java#L28-L64","documentation":"SaveProcessDefinitionInfoCmd.execute throws FlowableIllegalArgumentException when the processDefinitionId supplied to the command is null. The command needs the id to look up or create the corresponding ProcessDefinitionInfoEntity, so a null id makes the operation meaningless. This is an argument-validation guard at the very start of the command.","triggerScenarios":"Calling managementService.saveProcessDefinitionInfo(null, infoNode) or constructing new SaveProcessDefinitionInfoCmd(null, infoNode) and executing it.","commonSituations":"Passing an unassigned/uninitialized variable as the process definition id; a lookup that returned null upstream and its result was forwarded without checking; programmatic API misuse where the id field was never set.","solutions":["Pass a valid, non-null process definition id string when calling saveProcessDefinitionInfo.","Resolve the id first, e.g. via repositoryService.createProcessDefinitionQuery() ... singleResult().getId(), and check it for null before invoking.","Ensure the process definition is actually deployed so a real id exists to pass."],"exampleFix":"// before\nmanagementService.saveProcessDefinitionInfo(null, infoNode);\n// after\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionKey(\"myProcess\").latestVersion().singleResult();\nif (pd != null) {\n    managementService.saveProcessDefinitionInfo(pd.getId(), infoNode);\n}","handlingStrategy":"validation","validationCode":"if (processDefinitionId == null || processDefinitionId.isEmpty()) {\n    throw new IllegalArgumentException(\"processDefinitionId must be provided\");\n}\nmanagementService.saveProcessDefinitionInfo(processDefinitionId, infoNode);","typeGuard":"boolean hasId = id instanceof String && !((String) id).isEmpty();","tryCatchPattern":null,"preventionTips":["Resolve ids from repositoryService queries instead of hardcoding or caching them.","Null-check all ids at service boundaries before invoking Flowable commands.","Never forward the result of singleResult() without a null check."],"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"}