flowable/flowable-engine · error · FlowableException
Error converting resource stream
Error message
Error converting resource stream
What it means
Thrown by AppDefinitionResourceDataResource.getAppDefinitionResource when the deployed app definition resource exists but reading its byte content from the repository resource stream fails. The library wraps the underlying IOException in a FlowableException with this message. It indicates an I/O problem while converting the resource stream to a byte array, not a missing resource.
Source
Thrown at modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDefinitionResourceDataResource.java:93
}
// Check if deployment exists
AppDeployment deployment = appRepositoryService.createDeploymentQuery().deploymentId(appDefinition.getDeploymentId()).singleResult();
if (deployment == null) {
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
- Check the wrapped cause (e.getCause()) in server logs for the real I/O error and fix storage connectivity/corruption.
- Verify the deployment is intact: redeploy the .app/ZIP artifact.
- Confirm the DB/filesystem where Flowable stores deployment resources is healthy and has free space.
- If OOM-related, increase heap or stream the resource instead of loading it fully into a byte array.
Example fix
// before
try {
return IOUtils.toByteArray(resourceStream);
} catch (Exception e) {
throw new FlowableException("Error converting resource stream", e);
}
// after
try {
return IOUtils.toByteArray(resourceStream);
} catch (IOException e) {
logger.error("Failed reading resource for deployment " + appDefinition.getDeploymentId(), e);
throw new FlowableException("Error converting resource stream", e);
} Defensive patterns
Strategy: try-catch
Validate before calling
// Verify resource exists before fetching bytes
AppDeploymentResourceResponse r = restTemplate.getForObject(
"/app-repository/deployments/" + deploymentId + "/resources", AppDeploymentResourceResponse.class);
if (r == null) throw new IllegalStateException("resource missing"); Try / catch
try {
byte[] data = restTemplate.getForObject(url, byte[].class);
} catch (HttpServerErrorException e) {
logger.error("Resource stream conversion failed; check cause on server", e);
throw new IllegalStateException("Resource could not be read from deployment", e);
} Prevention
- Always log the root cause (getCause) on the server.
- Keep deployment storage (DB/filesystem) healthy and monitored.
- Redeploy artifacts if the deployment store is suspected corrupted.
- Prefer streaming for large resources to avoid memory pressure.
When it happens
Trigger: GET /app-repository/app-definitions/{appDefinitionId}/resource resolves the deployment resource via repositoryService.getResourceAsStream(deploymentId, resourceName), but IOUtils.toByteArray(resourceStream) throws (stream already closed, corrupted deployment store, disk/DB read failure).
Common situations: Database or filesystem backing the deployment store is unreachable or corrupted; resource deleted mid-request; very large resources causing OOM-wrapped read failures.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Error converting resource stream
- Unexpected exception getting variable data
- Could not find a resource with id '<resourceName>' in deploy
- <e.getMessage()>
- Could not find an app deployment with id '<deploymentId>
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/3131580ef55d1e46.
Report an issue: GitHub.