{"record":{"id":"d28fd82695344d14","repo":"flowable/flowable-engine","slug":"deployment-id-is-null-d28fd8","errorCode":null,"errorMessage":"Deployment id is null","messagePattern":"Deployment id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetDeploymentKeyCmd.java","lineNumber":46,"sourceCode":"\r\n/**\r\n * @author Tijs Rademakers\r\n */\r\npublic class SetDeploymentKeyCmd implements Command<Void> {\r\n\r\n    protected String deploymentId;\r\n    protected String key;\r\n\r\n    public SetDeploymentKeyCmd(String deploymentId, String key) {\r\n        this.deploymentId = deploymentId;\r\n        this.key = key;\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 FlowableIllegalArgumentException(\"Deployment id is null\");\r\n        }\r\n\r\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\r\n        DeploymentEntity deployment = processEngineConfiguration.getDeploymentEntityManager().findById(deploymentId);\r\n\r\n        if (deployment == null) {\r\n            throw new FlowableObjectNotFoundException(\"No deployment found for id = '\" + deploymentId + \"'\", Deployment.class);\r\n        }\r\n\r\n        if (Flowable5Util.isFlowable5Deployment(deployment, commandContext)) {\r\n            throw new FlowableException(\"Not supported for version 5 deployments\");\r\n        }\r\n\r\n        // Update category\r\n        deployment.setKey(key);\r\n\r\n        FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();\r\n        if (eventDispatcher != null && eventDispatcher.isEnabled()) {\r","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetDeploymentKeyCmd.java#L28-L64","documentation":"SetDeploymentKeyCmd.execute throws FlowableIllegalArgumentException when deploymentId is null. The command sets the key on a deployment and needs a non-null id to load it. Argument-validation guard at the start of execute.","triggerScenarios":"Calling repositoryService.setDeploymentKey(null, key) or executing new SetDeploymentKeyCmd(null, key).","commonSituations":"Uninitialized id variable; forwarding a null result of a lookup; misuse of the management/repository API in scripts.","solutions":["Pass a valid, non-null deployment id string.","Resolve the id from a deployment query and null-check before invoking.","Guard API calls in generic helper code with an explicit id check."],"exampleFix":"// before\nrepositoryService.setDeploymentKey(deploymentId, key); // deploymentId null\n// after\nObjects.requireNonNull(deploymentId, \"deploymentId required\");\nrepositoryService.setDeploymentKey(deploymentId, key);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(deploymentId, \"deploymentId must not be null\");\nrepositoryService.setDeploymentKey(deploymentId, key);","typeGuard":"boolean hasDeploymentId = deploymentId instanceof String && ((String) deploymentId).length() > 0;","tryCatchPattern":null,"preventionTips":["Fail fast on missing ids with Objects.requireNonNull at call sites.","Track deployment ids returned by deployment completion rather than reconstructing them.","Add id-presence assertions in integration tests that exercise the repository API."],"tags":["flowable","null-argument","deployment","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-14T05:17:10.506Z"}