{"record":{"id":"5bce41383b3dc7e1","repo":"flowable/flowable-engine","slug":"could-not-find-a-deployment-with-id-deploymenti-5bce41","errorCode":null,"errorMessage":"Could not find a deployment with id '${deploymentId}'.","messagePattern":"Could not find a deployment with id '(.+?)'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/BaseDeploymentResource.java","lineNumber":37,"sourceCode":"import org.flowable.eventregistry.rest.service.api.EventRegistryRestApiInterceptor;\nimport org.springframework.beans.factory.annotation.Autowired;\n\n/**\n * @author Tijs Rademakers\n */\npublic class BaseDeploymentResource {\n\n    @Autowired\n    protected EventRepositoryService repositoryService;\n    \n    @Autowired(required=false)\n    protected EventRegistryRestApiInterceptor restApiInterceptor;\n\n    protected EventDeployment getEventDeployment(String deploymentId) {\n        EventDeployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();\n\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + deploymentId + \"'.\", EventDeployment.class);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessDeploymentById(deployment);\n        }\n        \n        return deployment;\n    }\n}\n","sourceCodeStart":19,"sourceCodeEnd":47,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/BaseDeploymentResource.java#L19-L47","documentation":"FlowableObjectNotFoundException thrown by BaseDeploymentResource.getEventDeployment when a deployment query by id returns no result. The REST API uses this to signal that the referenced event registry deployment does not exist, typically mapped to HTTP 404.","triggerScenarios":"A REST call such as GET /event-registry-deployments/{deploymentId} references a deploymentId that does not match any deployment in the ACT_DE_DATABASECHANGELOG/deployment tables, so repositoryService.createDeploymentQuery().deploymentId(id).singleResult() returns null.","commonSituations":"Client using a stale or wrong id after the deployment was deleted; querying a different database/tenant than where the deployment was made; truncating or swapping the database between deploy and query; confusing deployment ids with event definition keys.","solutions":["Verify the deploymentId by listing deployments via GET /event-registry-deployments and using a returned id","Check the app is connected to the same database/schema where the deployment was created","Re-deploy the event definition if the deployment was removed","If programmatically querying, use createDeploymentQuery().latest() or list results to confirm what exists"],"exampleFix":"// before\nGET /event-registry-repository/deployments/abc-123   // never deployed\n// after\ndeployments = repositoryService.createDeploymentQuery().list();\nGET /event-registry-repository/deployments/\" + deployments.get(0).getId()","handlingStrategy":"try-catch","validationCode":"long count = repositoryService.createDeploymentQuery().deploymentId(deploymentId).count();\nif (count == 0) { /* handle missing deployment before calling the REST API */ }","typeGuard":"boolean deploymentExists = id -> repositoryService.createDeploymentQuery().deploymentId(id).count() > 0;","tryCatchPattern":"try {\n    EventDeploymentResource d = restClient.getDeployment(deploymentId);\n} catch (FlowableObjectNotFoundException e) {\n    logger.warn(\"Deployment {} not found; redeploying\", deploymentId);\n    redeploy();\n}","preventionTips":["Persist deployment ids returned at deploy time and reuse them","List deployments first if the id is not guaranteed current","Ensure all environments point at the same database/schema the deployment was made to","Do not confuse deployment ids with event definition keys"],"tags":["rest","not-found","deployment","resource"],"backgroundTag":"resource-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"}