flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find a resource with id '<resourceName>' in deploy

Error message

Could not find a resource with id '<resourceName>' in deployment '<deploymentId>

What it means

Thrown by AppDefinitionResourceDataResource.getAppDefinitionResource when the repository returns null for the requested resourceName in the given deployment. Flowable signals 'resource not found in deployment' with FlowableObjectNotFoundException. The app definition exists, but no resource with that exact name is attached to its deployment.

Source

Thrown at modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDefinitionResourceDataResource.java:98

            throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + appDefinition.getDeploymentId());
        }

        List<String> resourceList = appRepositoryService.getDeploymentResourceNames(appDefinition.getDeploymentId());

        if (resourceList.contains(appDefinition.getResourceName())) {
            final InputStream resourceStream = appRepositoryService.getResourceAsStream(
                    appDefinition.getDeploymentId(), appDefinition.getResourceName());

            response.setContentType("application/json");
            try {
                return IOUtils.toByteArray(resourceStream);
            } catch (Exception e) {
                throw new FlowableException("Error converting resource stream", e);
            }
            
        } else {
            // Resource not found in deployment
            throw new FlowableObjectNotFoundException("Could not find a resource with id '" +
                    appDefinition.getResourceName() + "' in deployment '" + appDefinition.getDeploymentId());
        }
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. List actual resources first: GET /app-repository/deployments/{deploymentId}/resources and use an exact resource name from that list.
  2. Check case and path separators — resource lookup is exact-match; '.app' vs '.APP' or leading slashes matter.
  3. Redeploy the app so deployment and resources are consistent again.
  4. Catch FlowableObjectNotFoundException and return 404 instead of a 500 for missing resources.

Example fix

// before
byte[] data = restTemplate.getForObject(url, byte[].class); // 500 on wrong name
// after
List<AppDeploymentResourceResponse> resources = restTemplate.getForObject(
    "/app-repository/deployments/" + deploymentId + "/resources", List.class);
if (resources.stream().noneMatch(r -> r.getId().equals(resourceName))) {
    throw new IllegalArgumentException("Unknown resource: " + resourceName);
}
Defensive patterns

Strategy: validation

Validate before calling

// Check resource exists before requesting its bytes
List<AppDeploymentResourceResponse> resources = restTemplate.getForObject(
  "/app-repository/deployments/" + deploymentId + "/resources", List.class);
boolean exists = resources != null && resources.stream()
  .anyMatch(r -> r.getId().equals(resourceName));

Try / catch

try {
    byte[] data = restTemplate.getForObject(url, byte[].class);
} catch (HttpClientErrorException.NotFound e) {
    throw new UnknownResourceException(resourceName, deploymentId);
}

Prevention

When it happens

Trigger: GET /app-repository/app-definitions/{appDefinitionId}/resource where repositoryService.getResourceAsStream(appDefinition.getDeploymentId(), appDefinition.getResourceName()) returns null because the resource name does not match any resource stored in that deployment.

Common situations: Typos or case-mismatched resource names; deployment pruned/cleaned while definition metadata remained; querying the wrong engine/database; path separators differing from what was deployed.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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