{"record":{"id":"a0903930eeab0b35","repo":"flowable/flowable-engine","slug":"problem-reading-zip-input-stream-a09039","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-engine/src/main/java/org/flowable/engine/impl/repository/DeploymentBuilderImpl.java","lineNumber":131,"sourceCode":"    }\n\n    @Override\n    public DeploymentBuilder 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                    ResourceEntity 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    @Override\n    public DeploymentBuilder addBpmnModel(String resourceName, BpmnModel bpmnModel) {\n        BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();\n        String bpmn20Xml = new String(bpmnXMLConverter.convertToXML(bpmnModel), StandardCharsets.UTF_8);\n        addString(resourceName, bpmn20Xml);\n        return this;\n    }\n\n    @Override\n    public DeploymentBuilder name(String name) {\n        deployment.setName(name);\n        return this;\n    }\n","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/repository/DeploymentBuilderImpl.java#L113-L149","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the exception cause (getCause()) to find the real zip error.","Validate the archive: test it with unzip or new ZipInputStream(...).getNextEntry() before deploying.","Re-download/re-export the archive and verify integrity (checksum/size).","Ensure the stream is fully available and not closed before addZipInputStream runs.","If entries are encrypted or ZIP64, use a supported archive format or a newer JVM."],"exampleFix":"// before\ntry (InputStream is = new FileInputStream(maybeCorrupt)) {\n    repositoryService.createDeployment().addZipInputStream(is).deploy();\n}\n// after\ntry (InputStream is = new FileInputStream(archive)) {\n    ZipInputStream zis = new ZipInputStream(is);\n    if (zis.getNextEntry() == null) {\n        throw new IllegalStateException(\"Not a valid zip archive: \" + archive);\n    }\n    repositoryService.createDeployment().addZipInputStream(new BufferedInputStream(new FileInputStream(archive))).deploy();\n}","handlingStrategy":"try-catch","validationCode":"boolean isValidZip(File f) {\n    try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(f)))) {\n        return zis.getNextEntry() != null;\n    } catch (IOException e) { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n    repositoryService.createDeployment().addZipInputStream(zis).deploy();\n} catch (FlowableException e) {\n    throw new ArchiveException(\"Invalid business archive\", e.getCause());\n}","preventionTips":["Verify archive checksums after download/transfer before deploying.","Never deploy archives fetched over failed HTTP responses; check response status/content-type.","Open the zip with a probe entry read before handing it to the builder.","Log e.getCause() — the wrapped exception identifies the actual zip defect."],"tags":["java","flowable","deployment","zip","io"],"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-14T05:17:10.506Z"}