{"record":{"id":"83882616e7b6cffb","repo":"flowable/flowable-engine","slug":"process-definition-id-is-null-838826","errorCode":null,"errorMessage":"process definition id is null","messagePattern":"process definition id is null","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/SaveProcessDefinitionInfoCmd.java","lineNumber":45,"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 ActivitiIllegalArgumentException(\"process definition id is null\");\n        }\n\n        if (infoNode == null) {\n            throw new ActivitiIllegalArgumentException(\"process definition info node is null\");\n        }\n\n        ProcessDefinitionInfoEntityManager definitionInfoEntityManager = commandContext.getProcessDefinitionInfoEntityManager();\n        ProcessDefinitionInfoEntity definitionInfoEntity = definitionInfoEntityManager.findProcessDefinitionInfoByProcessDefinitionId(processDefinitionId);\n        if (definitionInfoEntity == null) {\n            definitionInfoEntity = new ProcessDefinitionInfoEntity();\n            definitionInfoEntity.setProcessDefinitionId(processDefinitionId);\n            commandContext.getProcessDefinitionInfoEntityManager().insertProcessDefinitionInfo(definitionInfoEntity);\n        } else {\n            commandContext.getProcessDefinitionInfoEntityManager().updateProcessDefinitionInfo(definitionInfoEntity);\n        }\n\n        try {\n            ObjectWriter writer = commandContext.getProcessEngineConfiguration().getObjectMapper().writer();","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/SaveProcessDefinitionInfoCmd.java#L27-L63","documentation":"SaveProcessDefinitionInfoCmd stores extra JSON info (an infoNode) attached to a process definition, and rejects a null processDefinitionId with ActivitiIllegalArgumentException before any entity lookup. The id is the key that ties the info record to the definition, so it is mandatory.","triggerScenarios":"repositoryService.saveProcessDefinitionInfo(null, infoNode), commonly because the definition id came from an optional request parameter, a lookup that returned null, or an uninitialized field.","commonSituations":"Admin tooling saving definition metadata from a form where the definition was never selected; code refactors dropping the id argument; scripts iterating definitions where one lookup returned null.","solutions":["Resolve the processDefinitionId explicitly (repositoryService.createProcessDefinitionQuery()...singleResult().getId()) before saving.","Null-check the id at the calling layer and surface a validation error to the user.","Fix the upstream lookup that produced the null id rather than defaulting it."],"exampleFix":"// before\nrepositoryService.saveProcessDefinitionInfo(processDefinitionId, infoNode);\n\n// after\nif (processDefinitionId == null) {\n    throw new IllegalArgumentException(\"processDefinitionId is required\");\n}\nrepositoryService.saveProcessDefinitionInfo(processDefinitionId, infoNode);","handlingStrategy":"validation","validationCode":"if (processDefinitionId == null || processDefinitionId.isEmpty()) throw new IllegalArgumentException(\"processDefinitionId is required\");","typeGuard":"boolean canSaveInfo(String id, JsonNode node) { return id != null && !id.isEmpty() && node != null; }","tryCatchPattern":"try {\n    repositoryService.saveProcessDefinitionInfo(id, infoNode);\n} catch (ActivitiIllegalArgumentException e) {\n    throw new BadRequestException(\"processDefinitionId is required\");\n}","preventionTips":["Resolve definition ids via a query before saving info","Validate optional request parameters that feed the id","Reject incomplete admin forms client-side"],"tags":["activiti","flowable","null-argument","process-definition"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}