flowable/flowable-engine · error · FlowableIllegalArgumentException

inputStream for resource '' is null

Error message

inputStream for resource '' is null

What it means

DeploymentBuilderImpl.addInputStream validates that the given InputStream is non-null before reading it. A null stream cannot be converted into a deployment resource, so a FlowableIllegalArgumentException naming the resource is thrown immediately.

Solutions

  1. Ensure the InputStream is produced successfully (check the classpath resource exists) before calling addInputStream.
  2. If the resource may be absent, check for null first and fail with your own descriptive error.
  3. Prefer addClasspathResource(String) which loads and validates the resource in one call.
  4. Close streams properly (try-with-resources) so failed reads don't leave null/partial streams.

Example fix

// before
repositoryService.createDeployment().addInputStream("process.bpmn20.xml", getClass().getResourceAsStream(path)).deploy();
// after
try (InputStream is = getClass().getResourceAsStream(path)) {
    if (is == null) throw new IllegalArgumentException("Missing resource: " + path);
    repositoryService.createDeployment().addInputStream("process.bpmn20.xml", is).deploy();
}
Defensive patterns

Strategy: type-guard

Validate before calling

InputStream is = getClass().getResourceAsStream(path);
if (is == null) throw new IllegalArgumentException("Resource missing on classpath: " + path);

Type guard

boolean hasStream(InputStream is) { return is != null; }

Try / catch

try { builder.addInputStream(name, is); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().startsWith("inputStream for resource")) { /* fix resource loading */ } else throw e; }

Prevention

When it happens

Trigger: Calling repositoryService.createDeployment().addInputStream(name, stream) with a stream variable that is null — e.g. getResourceAsStream/ClassLoader lookup returned null, an IO helper produced null, or the stream variable was never initialized.

Common situations: Loading BPMN/XML from a classpath or file path that doesn't exist so the loader returns null instead of throwing; refactoring that renamed a resource leaving the stream null; dynamic resource resolution in CI tooling passing null on missing files.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/repository/DeploymentBuilderImpl.java:66

    protected transient ResourceEntityManager resourceEntityManager;

    protected DeploymentEntity deployment;
    protected boolean isBpmn20XsdValidationEnabled = true;
    protected boolean isProcessValidationEnabled = true;
    protected boolean isDuplicateFilterEnabled;
    protected Date processDefinitionsActivationDate;
    protected Map<String, Object> deploymentProperties = new HashMap<>();

    public DeploymentBuilderImpl(RepositoryServiceImpl repositoryService) {
        this.repositoryService = repositoryService;
        this.deployment = CommandContextUtil.getProcessEngineConfiguration().getDeploymentEntityManager().create();
        this.resourceEntityManager = CommandContextUtil.getProcessEngineConfiguration().getResourceEntityManager();
    }

    @Override
    public DeploymentBuilder addInputStream(String resourceName, InputStream inputStream) {
        if (inputStream == null) {
            throw new FlowableIllegalArgumentException("inputStream for resource '" + resourceName + "' is null");
        }
        byte[] bytes = IoUtil.readInputStream(inputStream, resourceName);
        ResourceEntity resource = resourceEntityManager.create();
        resource.setName(resourceName);
        resource.setBytes(bytes);
        deployment.addResource(resource);
        return this;
    }

    @Override
    public DeploymentBuilder addClasspathResource(String resource) {
        try (final InputStream inputStream = ReflectUtil.getResourceAsStream(resource)) {
	        if (inputStream == null) {
	            throw new FlowableIllegalArgumentException("resource '" + resource + "' not found");
	        }
	        return addInputStream(resource, inputStream);
	        
        } catch (IOException ex) {

View on GitHub (pinned to d6d39ce1c6)