{"record":{"id":"b9ea3a39fcc4bcf3","repo":"flowable/flowable-engine","slug":"problem-reading-zip-input-stream","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-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java","lineNumber":128,"sourceCode":"    }\n    \n    @Override\n    public AppDeploymentBuilder 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                    AppResourceEntity 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 AppDeploymentBuilder name(String name) {\n        deployment.setName(name);\n        return this;\n    }\n\n    @Override\n    public AppDeploymentBuilder category(String category) {\n        deployment.setCategory(category);\n        return this;\n    }\n    \n    @Override\n    public AppDeploymentBuilder key(String key) {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDeploymentBuilderImpl.java#L110-L146","documentation":"addZipInputStream wraps any Exception raised while iterating zip entries (getNextEntry, read, close) in a FlowableException with this message, preserving the cause. It signals corrupted or unreadable zip content rather than a programming error.","triggerScenarios":"Passing a corrupt/truncated zip stream, a stream of wrong format (e.g. gzip), an already-closed stream, or an entry read that throws IOException while deploying an app bar file via addZipInputStream.","commonSituations":"Incomplete upload of an app .zip/.bar artifact, file renamed to .zip without being a zip, stream closed by a try-with-resources before the builder consumes it, or an interrupted download.","solutions":["Inspect the wrapped cause (e.getCause()) to find the underlying zip error.","Verify the file is a valid, complete zip (unzip -t / ZipFile test) before deploying.","Re-download or re-export the artifact.","Ensure the stream is fresh and not closed before addZipInputStream runs; keep construction and deployment in the same scope."],"exampleFix":"// before\nbuilder.addZipInputStream(new java.util.zip.ZipInputStream(closedStream));\n// after\ntry (InputStream in = new java.io.FileInputStream(zipFile)) {\n    builder.addZipInputStream(new java.util.zip.ZipInputStream(in));\n} catch (FlowableException e) {\n    logger.error(\"bad app zip: {}\", e.getCause());\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"// verify the stream is a readable zip before deploying\nif (!zipFile.getName().endsWith(\".zip\") && !zipFile.getName().endsWith(\".bar\"))\n    throw new IllegalArgumentException(\"not a zip artifact: \" + zipFile);","typeGuard":null,"tryCatchPattern":"try {\n    builder.addZipInputStream(new java.util.zip.ZipInputStream(in));\n} catch (org.flowable.common.engine.api.FlowableException e) {\n    Throwable cause = e.getCause();\n    logger.error(\"Zip deploy failed: {}\", cause == null ? e : cause);\n    throw new IllegalStateException(\"Invalid app zip artifact\", e);\n}","preventionTips":["Validate zip integrity (unzip -t) before deploying","Keep the stream open until the builder finishes consuming it","Re-download artifacts after failed transfers","Never pass an already-consumed stream"],"tags":["java","flowable","zip","io","deployment"],"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"}