{"record":{"id":"5cb05e7d5e07eef7","repo":"flowable/flowable-engine","slug":"deployment-id-is-null-5cb05e","errorCode":null,"errorMessage":"Deployment id is null","messagePattern":"Deployment id is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/DeploymentQueryImpl.java","lineNumber":57,"sourceCode":"    protected boolean withoutTenantId;\n    protected String processDefinitionKey;\n    protected String processDefinitionKeyLike;\n\n    public DeploymentQueryImpl() {\n    }\n\n    public DeploymentQueryImpl(CommandContext commandContext) {\n        super(commandContext);\n    }\n\n    public DeploymentQueryImpl(CommandExecutor commandExecutor) {\n        super(commandExecutor);\n    }\n\n    @Override\n    public DeploymentQueryImpl deploymentId(String deploymentId) {\n        if (deploymentId == null) {\n            throw new ActivitiIllegalArgumentException(\"Deployment id is null\");\n        }\n        this.deploymentId = deploymentId;\n        return this;\n    }\n\n    @Override\n    public DeploymentQueryImpl deploymentName(String deploymentName) {\n        if (deploymentName == null) {\n            throw new ActivitiIllegalArgumentException(\"deploymentName is null\");\n        }\n        this.name = deploymentName;\n        return this;\n    }\n\n    @Override\n    public DeploymentQueryImpl deploymentNameLike(String nameLike) {\n        if (nameLike == null) {\n            throw new ActivitiIllegalArgumentException(\"deploymentNameLike is null\");","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/DeploymentQueryImpl.java#L39-L75","documentation":"Activiti's DeploymentQueryImpl.deploymentId() validates its argument before building the query. If you pass a null deployment id, the library throws ActivitiIllegalArgumentException immediately rather than issuing a query that cannot match or would return wrong results. This is an early-fail guard for a required query parameter.","triggerScenarios":"Calling repositoryService.createDeploymentQuery().deploymentId(null), typically when the id variable was never assigned, came from an optional request parameter, or a previous lookup (e.g. processInstance.getDeploymentId()) returned null.","commonSituations":"REST/DTO layers mapping optional 'deploymentId' query params straight into the API; code that resolved a deployment id from an entity that has no deployment; refactors that removed an id assignment upstream.","solutions":["Pass a non-null deployment id string to deploymentId()","Check for null before calling deploymentId() and skip or branch the query","Trace where the id comes from and fix the upstream null (unpersisted entity, failed lookup)","If the filter is optional, only add it when the id is present"],"exampleFix":"// before\nDeploymentQuery q = repositoryService.createDeploymentQuery().deploymentId(request.getDeploymentId());\n// after\nDeploymentQuery q = repositoryService.createDeploymentQuery();\nif (request.getDeploymentId() != null) {\n    q = q.deploymentId(request.getDeploymentId());\n}","handlingStrategy":"validation","validationCode":"if (deploymentId == null) { throw new IllegalArgumentException(\"deploymentId must not be null\"); }\nrepositoryService.createDeploymentQuery().deploymentId(deploymentId)...","typeGuard":"boolean hasDeploymentId(String id) { return id != null && !id.trim().isEmpty(); }","tryCatchPattern":"try {\n    Deployment d = repositoryService.createDeploymentQuery().deploymentId(id).singleResult();\n} catch (ActivitiIllegalArgumentException e) {\n    log.error(\"Invalid deployment query argument\", e);\n}","preventionTips":["Null-check ids at API/DTO boundaries before reaching the engine","Make id fields @NotNull-validated in request objects","Never pass optional filters unconditionally; wrap in null checks"],"tags":["java","activiti","null-argument","query"],"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"}