flowable/flowable-engine · error · FlowableObjectNotFoundException

no resource found with name '${resourceName}' in deployment

Error message

no resource found with name '${resourceName}' in deployment '${deploymentId}'

What it means

FlowableObjectNotFoundException thrown when the deployment exists but findResourceByDeploymentIdAndResourceName returned no resource for that exact name. The second branch of the null-resource check: the deployment lookup succeeded, so the resource name must be wrong. Thrown with InputStream.class as the expected type.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDeploymentResourceCmd.java:55

        this.deploymentId = deploymentId;
        this.resourceName = resourceName;
    }

    @Override
    public InputStream execute(CommandContext commandContext) {
        if (deploymentId == null) {
            throw new FlowableIllegalArgumentException("deploymentId is null");
        }
        if (resourceName == null) {
            throw new FlowableIllegalArgumentException("resourceName is null");
        }

        ResourceEntity resource = CommandContextUtil.getResourceEntityManager().findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
        if (resource == null) {
            if (CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId) == null) {
                throw new FlowableObjectNotFoundException("deployment does not exist: " + deploymentId, Deployment.class);
            } else {
                throw new FlowableObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", InputStream.class);
            }
        }
        return new ByteArrayInputStream(resource.getBytes());
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. List actual names: repositoryService.getDeploymentResourceNames(deploymentId) and use an exact entry.
  2. Compare case-sensitively and check the full resource path (subdirectories are part of the name).
  3. Catch FlowableObjectNotFoundException and check getEntityClass()==InputStream.class to distinguish from a missing deployment.
  4. Redeploy including the missing resource if it genuinely should exist.

Example fix

// before
repositoryService.getResource(depId, "myProcess.bpmn");
// after
String name = repositoryService.getDeploymentResourceNames(depId).stream()
    .filter(n -> n.endsWith(".bpmn20.xml") || n.endsWith(".bpmn")).findFirst()
    .orElseThrow(() -> new IllegalStateException("no bpmn resource"));
repositoryService.getResource(depId, name);
Defensive patterns

Strategy: fallback

Validate before calling

List<String> available = repositoryService.getDeploymentResourceNames(deploymentId);
if (!available.contains(resourceName)) {
    resourceName = available.stream().filter(n -> n.endsWith(".bpmn") || n.endsWith(".bpmn20.xml"))
        .findFirst().orElse(null);
}

Type guard

boolean hasResource(String deploymentId, String name) {
    return repositoryService.getDeploymentResourceNames(deploymentId)
        .stream().anyMatch(name::equals);
}

Try / catch

try {
    return repositoryService.getResource(deploymentId, resourceName);
} catch (FlowableObjectNotFoundException e) {
    if (InputStream.class.equals(e.getEntityClass())) {
        // deployment exists but name mismatch: fall back to first bpmn resource
        return loadFirstBpmnResource(deploymentId);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling repositoryService.getResource(deploymentId, resourceName) with a name that is not an exact, case-sensitive match of a deployed resource — e.g. 'diagram.bpmn' vs 'diagram.bpmn20.xml', wrong path prefix, or the resource was never included in the deployment.

Common situations: Case-sensitivity mismatches (Dev built on Windows, deployed to Linux); assuming a PNG diagram exists when only the BPMN XML was deployed; hard-coded names that broke after renaming the resource file.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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