{"record":{"id":"d6d87ced43014af1","repo":"flowable/flowable-engine","slug":"could-not-find-deployment-with-id-deploymentid-d6d87c","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/SetDeploymentTenantIdCmd.java","lineNumber":53,"sourceCode":"    protected String deploymentId;\n    protected String newTenantId;\n\n    public SetDeploymentTenantIdCmd(String deploymentId, String newTenantId) {\n        this.deploymentId = deploymentId;\n        this.newTenantId = newTenantId;\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.setTenantId(newTenantId);\n\n        CommandContextUtil.getEventDefinitionEntityManager(commandContext).updateEventDefinitionTenantIdForDeployment(deploymentId, newTenantId);\n\n        // Doing event definitions in memory, cause we need to clear the event definition cache\n        List<EventDefinition> eventDefinitions = new EventDefinitionQueryImpl().deploymentId(deploymentId).list();\n        for (EventDefinition eventDefinition : eventDefinitions) {\n            CommandContextUtil.getEventRegistryConfiguration().getEventDefinitionCache().remove(eventDefinition.getId());\n        }\n\n        CommandContextUtil.getDeploymentEntityManager(commandContext).update(deployment);\n\n        return null;\n\n    }\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/cmd/SetDeploymentTenantIdCmd.java#L35-L71","documentation":"SetDeploymentTenantIdCmd throws FlowableObjectNotFoundException when the event deployment with the given id does not exist in the event registry. It is thrown inside the command's execute() right after findById(deploymentId) returns null, before the tenant id change is applied to the deployment and its event definitions.","triggerScenarios":"Calling the SetDeploymentTenantIdCmd command (or EventRepositoryService setDeploymentTenantId APIs) with a deploymentId that was never deployed, was already deleted, or belongs to a different event registry engine/database.","commonSituations":"Hardcoded or stale deployment ids after a redeployment (ids change per deployment), running against a wrong database schema, deleting deployments in one environment and reusing ids in another, or typo/whitespace in the id string.","solutions":["Query the deployment first (eventRepositoryService.createDeploymentQuery().deploymentId(id)) and verify it exists before setting the tenant id.","Print/correct the deploymentId - fetch actual ids via eventRepositoryService.createDeploymentQuery().list().","Verify you are connected to the same event registry engine/database where the deployment was made."],"exampleFix":"// before\neventRepositoryService.setDeploymentTenantId(\"my-deployment-id\", \"tenant-1\");\n// after\nEventDeployment d = eventRepositoryService.createDeploymentQuery().deploymentId(\"my-deployment-id\").singleResult();\nif (d != null) {\n    eventRepositoryService.setDeploymentTenantId(d.getId(), \"tenant-1\");\n}","handlingStrategy":"validation","validationCode":"EventDeployment d = eventRepositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();\nif (d == null) throw new IllegalArgumentException(\"Unknown deployment: \" + deploymentId);","typeGuard":null,"tryCatchPattern":"try { eventRepositoryService.setDeploymentTenantId(id, tenant); } catch (FlowableObjectNotFoundException e) { log.warn(\"Deployment {} not found\", id); }","preventionTips":["Resolve deployment ids from a deployment query, never hardcode them","Remember ids change on every redeployment","Confirm engine/database connection matches where the deployment lives"],"tags":["flowable","event-registry","not-found","deployment"],"backgroundTag":"record-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"}