flowable/flowable-engine · error · FlowableException

problem reading zip input stream

Error message

problem reading zip input stream

What it means

DeploymentBuilder.addZipInputStream iterates a ZIP archive, adding each entry as a deployment resource. Any exception while reading the stream (corrupt archive, truncated download, unsupported entry, closed stream) is wrapped in a FlowableException with this message. The cause holds the underlying failure.

Source

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

    }

    @Override
    public DeploymentBuilder addZipInputStream(ZipInputStream zipInputStream) {
        try {
            ZipEntry entry = zipInputStream.getNextEntry();
            while (entry != null) {
                if (!entry.isDirectory()) {
                    String entryName = entry.getName();
                    byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);
                    ResourceEntity resource = resourceEntityManager.create();
                    resource.setName(entryName);
                    resource.setBytes(bytes);
                    deployment.addResource(resource);
                }
                entry = zipInputStream.getNextEntry();
            }
        } catch (Exception e) {
            throw new FlowableException("problem reading zip input stream", e);
        }
        return this;
    }

    @Override
    public DeploymentBuilder addBpmnModel(String resourceName, BpmnModel bpmnModel) {
        BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
        String bpmn20Xml = new String(bpmnXMLConverter.convertToXML(bpmnModel), StandardCharsets.UTF_8);
        addString(resourceName, bpmn20Xml);
        return this;
    }

    @Override
    public DeploymentBuilder name(String name) {
        deployment.setName(name);
        return this;
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect the exception cause (getCause()) to find the real zip error.
  2. Validate the archive: test it with unzip or new ZipInputStream(...).getNextEntry() before deploying.
  3. Re-download/re-export the archive and verify integrity (checksum/size).
  4. Ensure the stream is fully available and not closed before addZipInputStream runs.
  5. If entries are encrypted or ZIP64, use a supported archive format or a newer JVM.

Example fix

// before
try (InputStream is = new FileInputStream(maybeCorrupt)) {
    repositoryService.createDeployment().addZipInputStream(is).deploy();
}
// after
try (InputStream is = new FileInputStream(archive)) {
    ZipInputStream zis = new ZipInputStream(is);
    if (zis.getNextEntry() == null) {
        throw new IllegalStateException("Not a valid zip archive: " + archive);
    }
    repositoryService.createDeployment().addZipInputStream(new BufferedInputStream(new FileInputStream(archive))).deploy();
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean isValidZip(File f) {
    try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(f)))) {
        return zis.getNextEntry() != null;
    } catch (IOException e) { return false; }
}

Try / catch

try {
    repositoryService.createDeployment().addZipInputStream(zis).deploy();
} catch (FlowableException e) {
    throw new ArchiveException("Invalid business archive", e.getCause());
}

Prevention

When it happens

Trigger: Calling addZipInputStream with a corrupted or partially downloaded .bar/.zip; stream already closed; non-zip content (e.g. HTML error page saved as .zip); unreadable zip entries; encrypted archives not supported by java.util.zip.

Common situations: Deploying a business archive fetched over HTTP where the download failed; CI artifact truncated; file copied incompletely; wrong file uploaded with a .bar extension; ZIP64 archives exceeding java.util.zip limits in old JVMs.

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


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