{"record":{"id":"cb0dde0a07a4fafd","repo":"flowable/flowable-engine","slug":"could-not-find-deployment-with-id-deploymentid-cb0dde","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-engine/src/main/java/org/flowable/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        DeploymentEntity 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-engine/src/main/java/org/flowable/engine/impl/cmd/SetDeploymentParentDeploymentIdCmd.java#L31-L61","documentation":"Flowable throws this FlowableObjectNotFoundException when SetDeploymentParentDeploymentIdCmd.execute cannot load a DeploymentEntity for the given deploymentId via the DeploymentEntityManager. It means the runtime is being asked to change a deployment's parent, but no deployment with that id exists in the ACT_GE_DEPLOYMENT table. The command aborts before updating parentDeploymentId.","triggerScenarios":"Calling ManagementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, newParentDeploymentId)) with a deployment id that was never created, was deleted (e.g. via RepositoryService.deleteDeployment), or belongs to a different database/tenant.","commonSituations":"Hardcoded or stale deployment ids in scripts; running against a different database (test vs prod) than the one that created the deployment; cascaded deletes removing the deployment; id mismatch after re-deployment produces a new id.","solutions":["Print and verify the actual deployment id via RepositoryService.createDeploymentQuery().list() and use that id","Check you are connected to the same database/schema where the deployment was created","Re-create or re-deploy the resource if the deployment was deleted, then re-run the command","If the deployment may legitimately be absent, wrap the call in try/catch for FlowableObjectNotFoundException and handle the missing case"],"exampleFix":"// before\nmanagementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(\"my-deployment\", parentId));\n// after\nDeployment dep = repositoryService.createDeploymentQuery().deploymentName(\"my-app\").latest().singleResult();\nmanagementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(dep.getId(), parentId));","handlingStrategy":"validation","validationCode":"Deployment dep = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();\nif (dep == null) {\n    throw new IllegalStateException(\"Deployment not found: \" + deploymentId);\n}","typeGuard":"boolean deploymentExists(String deploymentId) {\n    return deploymentId != null\n        && repositoryService.createDeploymentQuery().deploymentId(deploymentId).count() > 0;\n}","tryCatchPattern":"try {\n    managementService.executeCommand(new SetDeploymentParentDeploymentIdCmd(deploymentId, parentId));\n} catch (FlowableObjectNotFoundException e) {\n    log.warn(\"Deployment {} does not exist\", deploymentId, e);\n}","preventionTips":["Resolve deployment ids via DeploymentQuery instead of hardcoding them","Confirm the same database/schema is used at lookup and update time","Remember deleteDeployment removes the deployment; re-deploy if needed"],"tags":["flowable","not-found","deployment","java"],"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-18T11:17:12.947Z"}