{"record":{"id":"e439f0ee61a2d1d5","repo":"flowable/flowable-engine","slug":"could-not-find-deployment-with-id-deploymentid-e439f0","errorCode":null,"errorMessage":"Could not find deployment with id ${deploymentId}","messagePattern":"Could not find deployment with id (.+?)","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/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        EventDeploymentEntity deployment = CommandContextUtil.getDeploymentEntityManager(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.getDeploymentEntityManager(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-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/SetDeploymentParentDeploymentIdCmd.java#L31-L61","documentation":"SetDeploymentParentDeploymentIdCmd.execute() loads the EventDeploymentEntity by id; if findById returns null it throws FlowableObjectNotFoundException('Could not find deployment with id ...'). The parent deployment id can only be set on an existing event deployment.","triggerScenarios":"Calling setDeploymentParentDeploymentId with an id that does not exist in ACT_FO_DEPLOYMENT — wrong environment, deleted deployment, or an id from a different engine's deployment table.","commonSituations":"Cross-environment config (ids baked in from another DB); deployment cleanup jobs removing the child between steps; confusing process-engine deployment ids with event-registry deployment ids.","solutions":["Query eventRepositoryService.createDeploymentQuery() to confirm the deployment id exists and use a fresh id.","Redeploy the event definitions if the deployment was deleted, then set the parent id.","Verify you are not passing a deployment id from another Flowable engine.","Ensure the database connection points at the intended environment."],"exampleFix":"// before\neventRepositoryService.setDeploymentParentDeploymentId(\"deploy-99\", \"parent-1\"); // deploy-99 deleted\n// after\nEventDeployment dep = eventRepositoryService.createDeploymentQuery().deploymentName(\"myEvents\").singleResult();\neventRepositoryService.setDeploymentParentDeploymentId(dep.getId(), \"parent-1\");","handlingStrategy":"try-catch","validationCode":"if (eventRepositoryService.createDeploymentQuery().deploymentId(deploymentId).count() == 0) {\n    throw new IllegalStateException(\"Event deployment missing: \" + deploymentId);\n}","typeGuard":"boolean deploymentExists(String id) {\n    return id != null && eventRepositoryService.createDeploymentQuery().deploymentId(id).count() > 0;\n}","tryCatchPattern":"try {\n    eventRepositoryService.setDeploymentParentDeploymentId(id, parentId);\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"Event deployment {} gone; redeploy and re-link\", id, e);\n}","preventionTips":["Verify ids exist right before mutating operations.","Account for deployment cleanup jobs in id lifetimes.","Confirm environment/database consistency between deploy and update steps."],"tags":["flowable","event-registry","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-14T05:17:10.506Z"}