{"record":{"id":"a3d66cf4d1428e0b","repo":"flowable/flowable-engine","slug":"deployment-id-is-null-a3d66c","errorCode":null,"errorMessage":"Deployment id is null","messagePattern":"Deployment id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/SetDeploymentCategoryCmd.java","lineNumber":39,"sourceCode":"\n/**\n * @author Tijs Rademakers\n */\npublic class SetDeploymentCategoryCmd implements Command<Void> {\n\n    protected String deploymentId;\n    protected String category;\n\n    public SetDeploymentCategoryCmd(String deploymentId, String category) {\n        this.deploymentId = deploymentId;\n        this.category = category;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n\n        if (deploymentId == null) {\n            throw new FlowableIllegalArgumentException(\"Deployment id is null\");\n        }\n\n        EventDeploymentEntity deployment = CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId);\n\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"No deployment found for id = '\" + deploymentId + \"'\");\n        }\n\n        // Update category\n        deployment.setCategory(category);\n        CommandContextUtil.getDeploymentEntityManager(commandContext).update(deployment);\n\n        return null;\n    }\n\n    public String getDeploymentId() {\n        return deploymentId;\n    }","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/SetDeploymentCategoryCmd.java#L21-L57","documentation":"SetDeploymentCategoryCmd.execute() validates the deploymentId argument; if null it throws FlowableIllegalArgumentException immediately. Setting a category requires an existing event deployment identified by id.","triggerScenarios":"Calling setDeploymentCategory (or constructing SetDeploymentCategoryCmd) with a null deployment id, typically from an unresolved lookup or unpopulated config value.","commonSituations":"A deployment query returned no results and the null was passed on; a variable shadowing bug; calling the API before any event deployments were made.","solutions":["Resolve the deployment id via a deployment query (e.g. eventRepositoryService.createDeploymentQuery()) before setting the category.","Validate deploymentId != null in the calling code and fail with a clear message.","Fix the upstream code/config that failed to supply the id."],"exampleFix":"// before\neventRepositoryService.setDeploymentCategory(null, \"events\");\n// after\nEventDeployment dep = eventRepositoryService.createDeploymentQuery().deploymentName(\"myEvents\").singleResult();\neventRepositoryService.setDeploymentCategory(dep.getId(), \"events\");","handlingStrategy":"validation","validationCode":"if (deploymentId == null || deploymentId.isBlank()) {\n    throw new IllegalArgumentException(\"deploymentId is required to set category\");\n}","typeGuard":"boolean hasDeploymentId(EventDeployment d) {\n    return d != null && d.getId() != null;\n}","tryCatchPattern":"try {\n    eventRepositoryService.setDeploymentCategory(deploymentId, category);\n} catch (FlowableIllegalArgumentException e) {\n    log.error(\"deploymentId was null; resolve deployment first\", e);\n}","preventionTips":["Capture the id returned by the deploy call immediately.","Null-check deployment queries before using their results.","Fail deployment pipelines early if the deploy step produced no id."],"tags":["flowable","event-registry","null-argument","deployment"],"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"}