{"record":{"id":"dfdeebf3bee0526b","repo":"flowable/flowable-engine","slug":"problem-reading-zip-input-stream-dfdeeb","errorCode":null,"errorMessage":"problem reading zip input stream","messagePattern":"problem reading zip input stream","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java","lineNumber":128,"sourceCode":"    }\n\n    @Override\n    public CmmnDeploymentBuilder addZipInputStream(ZipInputStream zipInputStream) {\n        try {\n            ZipEntry entry = zipInputStream.getNextEntry();\n            while (entry != null) {\n                if (!entry.isDirectory()) {\n                    String entryName = entry.getName();\n                    byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);\n                    CmmnResourceEntity resource = resourceEntityManager.create();\n                    resource.setName(entryName);\n                    resource.setBytes(bytes);\n                    deployment.addResource(resource);\n                }\n                entry = zipInputStream.getNextEntry();\n            }\n        } catch (Exception e) {\n            throw new FlowableException(\"problem reading zip input stream\", e);\n        }\n        return this;\n    }\n\n    public CmmnDeploymentBuilder addCmmnBytes(String resourceName, byte[] cmmnBytes) {\n        if (cmmnBytes == null) {\n            throw new FlowableException(\"cmmn bytes is null\");\n        }\n\n        CmmnResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(cmmnBytes);\n        deployment.addResource(resource);\n        return this;\n    }\n\n    public CmmnDeploymentBuilder addCmmnModel(String resourceName, CmmnModel cmmnModel) {\n        // TODO","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java#L110-L146","documentation":"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().","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect e.getCause() for the real underlying failure","Validate the zip/bar file is complete and opens correctly (e.g. test with ZipInputStream/zip tool) before deploying","Ensure the InputStream is fresh, positioned at start, and not closed early","Regenerate or re-upload the bar archive"],"exampleFix":"// before\nbuilder.addZipInputStream(new FileInputStream(uploadedBar)); // uploaded file may be truncated\n// after\ntry (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(uploadedBar)))) {\n    if (zis.getNextEntry() == null) { throw new IllegalArgumentException(\"Not a valid zip/bar file\"); }\n    builder.addZipInputStream(zis);\n}","handlingStrategy":"validation","validationCode":"try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(in))) {\n    if (zis.getNextEntry() == null) { throw new IllegalArgumentException(\"Stream is not a valid zip archive\"); }\n}","typeGuard":null,"tryCatchPattern":"try {\n    builder.addZipInputStream(zipStream);\n} catch (FlowableException e) {\n    if (\"problem reading zip input stream\".equals(e.getMessage())) {\n        logger.error(\"Corrupt or unreadable bar/zip: {}\", e.getCause(), e.getCause());\n        throw new DeploymentException(\"Invalid deployment archive\", e);\n    }\n    throw e;\n}","preventionTips":["Validate zip/bar archives at upload/ingestion time, before deployment","Always pass a fresh, unread InputStream; never reuse a consumed stream","Use BufferedInputStream and correct charset handling when creating the zip","Regenerate archives after failed or interrupted transfers"],"tags":["zip","io","deployment","bar-archive","cmmn"],"backgroundTag":"file-read-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}