{"record":{"id":"bae06cbef2a78917","repo":"flowable/flowable-engine","slug":"deployment-id-is-null-bae06c","errorCode":null,"errorMessage":"Deployment id is null","messagePattern":"Deployment id is null","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/SetDeploymentCategoryCmd.java","lineNumber":42,"sourceCode":"\r\n/**\r\n * @author Tijs Rademakers\r\n */\r\npublic class SetDeploymentCategoryCmd implements Command<Void> {\r\n\r\n    protected String deploymentId;\r\n    protected String category;\r\n\r\n    public SetDeploymentCategoryCmd(String deploymentId, String category) {\r\n        this.deploymentId = deploymentId;\r\n        this.category = category;\r\n    }\r\n\r\n    @Override\r\n    public Void execute(CommandContext commandContext) {\r\n\r\n        if (deploymentId == null) {\r\n            throw new ActivitiIllegalArgumentException(\"Deployment id is null\");\r\n        }\r\n\r\n        DeploymentEntity deployment = commandContext\r\n                .getDeploymentEntityManager()\r\n                .findDeploymentById(deploymentId);\r\n\r\n        if (deployment == null) {\r\n            throw new ActivitiObjectNotFoundException(\"No deployment found for id = '\" + deploymentId + \"'\", Deployment.class);\r\n        }\r\n\r\n        // Update category\r\n        deployment.setCategory(category);\r\n\r\n        if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {\r\n            commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(\r\n                    ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, deployment),\r\n                    EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG);\r\n        }\r","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/SetDeploymentCategoryCmd.java#L24-L60","documentation":"SetDeploymentCategoryCmd changes a deployment's category, but first rejects a null deploymentId with ActivitiIllegalArgumentException. The deployment id is the key used to look up the deployment entity.","triggerScenarios":"Calling RepositoryService.setDeploymentCategory(null, category) or executing SetDeploymentCategoryCmd with a null deploymentId.","commonSituations":"Deployment id read from config/property that was never set, or a variable expected to hold the deployment id being null after a failed deployment lookup.","solutions":["Pass a valid, non-null deployment id obtained from the Deployment object returned by RepositoryService.createDeployment().deploy().","Guard the call site: only call setDeploymentCategory when the id is known non-null.","Fix the config/code path that yields a null deployment id."],"exampleFix":"// before\nrepositoryService.setDeploymentCategory(deploymentId, \"my-category\"); // deploymentId may be null\n// after\nif (deploymentId != null) {\n    repositoryService.setDeploymentCategory(deploymentId, \"my-category\");\n}","handlingStrategy":"validation","validationCode":"if (deploymentId == null || deploymentId.isEmpty()) throw new IllegalArgumentException(\"deploymentId required\");","typeGuard":null,"tryCatchPattern":"try { repositoryService.setDeploymentCategory(deploymentId, category); }\ncatch (ActivitiIllegalArgumentException e) { log.error(\"deployment id missing\"); }","preventionTips":["Capture the deployment id directly from the returned Deployment object","Validate ids before any repositoryService call","Avoid passing ids sourced from unresolved config placeholders"],"tags":["null-check","deployment","illegal-argument"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}