flowable/flowable-engine · error · FlowableException

problem reading zip input stream

Error message

problem reading zip input stream

What it means

FlowableException (with cause) thrown by CmmnDeploymentBuilderImpl.addZipInputStream when any exception occurs while iterating zip entries and copying their bytes into deployment resources. It wraps the underlying Exception, so the real failure (corrupt zip, truncated stream, IO error) is in getCause().

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java:128

    }

    @Override
    public CmmnDeploymentBuilder addZipInputStream(ZipInputStream zipInputStream) {
        try {
            ZipEntry entry = zipInputStream.getNextEntry();
            while (entry != null) {
                if (!entry.isDirectory()) {
                    String entryName = entry.getName();
                    byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);
                    CmmnResourceEntity 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;
    }

    public CmmnDeploymentBuilder addCmmnBytes(String resourceName, byte[] cmmnBytes) {
        if (cmmnBytes == null) {
            throw new FlowableException("cmmn bytes is null");
        }

        CmmnResourceEntity resource = resourceEntityManager.create();
        resource.setName(resourceName);
        resource.setBytes(cmmnBytes);
        deployment.addResource(resource);
        return this;
    }

    public CmmnDeploymentBuilder addCmmnModel(String resourceName, CmmnModel cmmnModel) {
        // TODO

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect e.getCause() for the real underlying failure
  2. Validate the zip/bar file is complete and opens correctly (e.g. test with ZipInputStream/zip tool) before deploying
  3. Ensure the InputStream is fresh, positioned at start, and not closed early
  4. Regenerate or re-upload the bar archive

Example fix

// before
builder.addZipInputStream(new FileInputStream(uploadedBar)); // uploaded file may be truncated
// after
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(uploadedBar)))) {
    if (zis.getNextEntry() == null) { throw new IllegalArgumentException("Not a valid zip/bar file"); }
    builder.addZipInputStream(zis);
}
Defensive patterns

Strategy: validation

Validate before calling

try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(in))) {
    if (zis.getNextEntry() == null) { throw new IllegalArgumentException("Stream is not a valid zip archive"); }
}

Try / catch

try {
    builder.addZipInputStream(zipStream);
} catch (FlowableException e) {
    if ("problem reading zip input stream".equals(e.getMessage())) {
        logger.error("Corrupt or unreadable bar/zip: {}", e.getCause(), e.getCause());
        throw new DeploymentException("Invalid deployment archive", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling addZipInputStream(zipInputStream) with a corrupted or truncated zip, a stream that is not actually ZIP format, a stream already fully consumed/closed, or IO failure mid-read.

Common situations: Deploying a .bar/.zip uploaded by users where the upload was cut off, reading a bar file from an incomplete download, passing a gzip stream instead of zip, reusing an already-read InputStream.

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/dfdeebf3bee0526b. Report an issue: GitHub.