{"record":{"id":"4dc8ea20b1ec8588","repo":"flowable/flowable-engine","slug":"could-not-find-deployment-with-id-deploymentid","errorCode":null,"errorMessage":"Could not find deployment with id ${deploymentId}","messagePattern":"Could not find deployment with id (.+?)","errorType":"validation","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetDeploymentParentDeploymentIdCmd.java","lineNumber":49,"sourceCode":"    protected String deploymentId;\n    protected String newParentDeploymentId;\n\n    public SetDeploymentParentDeploymentIdCmd(String deploymentId, String newParentDeploymentId) {\n        this.deploymentId = deploymentId;\n        this.newParentDeploymentId = newParentDeploymentId;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        if (deploymentId == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentId is null\");\n        }\n\n        // Update all entities\n\n        CmmnDeploymentEntity deployment = CommandContextUtil.getCmmnDeploymentEntityManager(commandContext).findById(deploymentId);\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find deployment with id \" + deploymentId);\n        }\n\n        deployment.setParentDeploymentId(newParentDeploymentId);\n\n        CommandContextUtil.getCmmnDeploymentEntityManager(commandContext).update(deployment);\n\n        return null;\n\n    }\n\n}\n","sourceCodeStart":31,"sourceCodeEnd":61,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetDeploymentParentDeploymentIdCmd.java#L31-L61","documentation":"SetDeploymentParentDeploymentIdCmd.execute throws FlowableObjectNotFoundException('Could not find deployment with id <id>') when the CmmnDeploymentEntityManager.findById lookup returns null, so the parent deployment id cannot be set.","triggerScenarios":"Calling setDeploymentParentDeploymentId(id, newParentDeploymentId) with an id of a deployment that does not exist in the CMMN repository.","commonSituations":"Deployment deleted before reparenting (cascade delete of cascading deployments); id from a BPMN deployment used against the CMMN repository service; database/schema or tenant mismatch.","solutions":["Confirm the deployment exists via cmmnRepositoryService.createDeploymentQuery().deploymentId(id)","Use the CMMN repository service for CMMN deployment ids (not the BPMN one)","Verify database/tenant configuration","Catch FlowableObjectNotFoundException and return a not-found response"],"exampleFix":"// before\ncmmnRepositoryService.setDeploymentParentDeploymentId(deploymentId, parentDeploymentId);\n// after\nif (cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() > 0) {\n    cmmnRepositoryService.setDeploymentParentDeploymentId(deploymentId, parentDeploymentId);\n} else {\n    logger.warn(\"Deployment {} not found\", deploymentId);\n}","handlingStrategy":"try-catch","validationCode":"boolean exists = cmmnRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() > 0;\nif (!exists) { throw new NotFoundException(\"Deployment not found: \" + deploymentId); }","typeGuard":null,"tryCatchPattern":"try {\n    cmmnRepositoryService.setDeploymentParentDeploymentId(deploymentId, parentDeploymentId);\n} catch (FlowableObjectNotFoundException e) {\n    throw new NotFoundException(e.getMessage(), e);\n}","preventionTips":["Remember cascading deletes may remove child deployments before reparenting","Use the CMMN repository service for CMMN deployments, not the BPMN one","Verify datasource and tenant configuration"],"tags":["flowable","cmmn","not-found","deployment"],"backgroundTag":"entity-not-found","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"}