flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find a deployment with id

Error message

Could not find a deployment with id '${deploymentId}'.

What it means

After parameter validation, getDeploymentResourceData queries repositoryService for the deployment with the given id; if no deployment matches, FlowableObjectNotFoundException is thrown (HTTP 404). This means the id is well-formed but no such deployment exists in the repository.

Solutions

  1. Fetch current deployment ids via GET /repository/deployments and use an existing id.
  2. Check you are pointing at the same environment/database where the deployment exists.
  3. Handle HTTP 404 by refreshing the deployment list instead of retrying the stale id.
  4. Verify the deployment wasn't deleted (check ACT_RE_DEPLOYMENT or the deployments endpoint).

Example fix

// before
GET /repository/deployments/99999/resourcedata/process.bpmn20.xml
// after
GET /repository/deployments/2501/resourcedata/process.bpmn20.xml  // id from /repository/deployments
Defensive patterns

Strategy: try-catch

Validate before calling

const deps = (await get('/repository/deployments')).data;
if (!deps.data.some(d => d.id === deploymentId)) throw new Error(`Deployment ${deploymentId} not found`);

Try / catch

try { return await getResourceData(deploymentId, name); }
catch (e) { if (e instanceof FlowableObjectNotFoundException || e.status === 404) { refreshDeployments(); return null; } throw e; }

Prevention

When it happens

Trigger: GET /repository/deployments/{deploymentId}/resourcedata/{resourceName} with a deploymentId that is not in ACT_RE_DEPLOYMENT (deleted deployment, wrong environment, or fabricated id).

Common situations: Deployment deleted by cleanup/undeploy scripts while client still caches old ids; dev vs prod environment mismatch; truncated or altered id from string handling.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/80d8dfe9d84faaa3. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/BaseDeploymentResourceDataResource.java:57

    @Autowired
    protected RepositoryService repositoryService;
    
    @Autowired(required=false)
    protected BpmnRestApiInterceptor restApiInterceptor;

    protected byte[] getDeploymentResourceData(String deploymentId, String resourceName, HttpServletResponse response) {

        if (deploymentId == null) {
            throw new FlowableIllegalArgumentException("No deployment id provided");
        }
        if (resourceName == null) {
            throw new FlowableIllegalArgumentException("No resource name provided");
        }

        // Check if deployment exists
        Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
        if (deployment == null) {
            throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class);
        }
        
        if (restApiInterceptor != null) {
            restApiInterceptor.accessDeploymentById(deployment);
        }

        List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);

        if (resourceList.contains(resourceName)) {
            String contentType = contentTypeResolver.resolveContentType(resourceName);
            response.setContentType(contentType);
            try (final InputStream resourceStream = repositoryService.getResourceAsStream(deploymentId, resourceName)) {
                return IOUtils.toByteArray(resourceStream);
                
            } catch (Exception e) {
                throw new FlowableException("Error converting resource stream", e);
            }
            

View on GitHub (pinned to d6d39ce1c6)