{"record":{"id":"16bfdeab399443a5","repo":"flowable/flowable-engine","slug":"could-not-completely-read-inputstream","errorCode":null,"errorMessage":"Could not completely read inputstream ","messagePattern":"Could not completely read inputstream ","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/io/InputStreamSource.java","lineNumber":69,"sourceCode":"    }\n\n    @Override\n    public String toString() {\n        return \"InputStream\";\n    }\n\n    public byte[] getBytesFromInputStream(InputStream inStream) throws IOException {\n        long length = inStream.available();\n        byte[] bytes = new byte[(int) length];\n\n        int offset = 0;\n        int numRead = 0;\n        while (offset < bytes.length && (numRead = inStream.read(bytes, offset, bytes.length - offset)) >= 0) {\n            offset += numRead;\n        }\n\n        if (offset < bytes.length) {\n            throw new FlowableException(\"Could not completely read inputstream \");\n        }\n\n        // Close the input stream and return bytes\n        inStream.close();\n        return bytes;\n    }\n\n}\n","sourceCodeStart":51,"sourceCodeEnd":78,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/io/InputStreamSource.java#L51-L78","documentation":"Thrown by InputStreamSource.getBytesFromInputStream when the stream ended before the expected number of bytes was read (offset < bytes.length). This indicates a truncated stream: the byte-count expectation did not match the actual stream content. Note the message has no suffix detail.","triggerScenarios":"The wrapped stream reports fewer bytes than the buffer expected — stream truncated at source (partial download, early EOF) or length metadata larger than actual data.","commonSituations":"Corrupted or partially uploaded deployment artifacts; network interruptions reading remote resources; reading streams whose available length was miscomputed.","solutions":["Verify the source resource is complete and not truncated (re-download/re-upload it)","Check network stability if the stream comes from a remote URL/repository","Compare the resource's declared size with the bytes actually available","Regenerate or redeploy the corrupted artifact"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"long expected = resource.length();\nlong actual = Files.size(Paths.get(path));\nif (expected != actual) throw new IllegalStateException(\"truncated resource: \" + path);","typeGuard":null,"tryCatchPattern":"try {\n    InputStream is = source.getInputStream();\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"completely read\")) {\n        throw new IllegalStateException(\"artifact truncated — re-upload the resource\");\n    }\n}","preventionTips":["Verify checksums/sizes of deployment artifacts before upload","Use stable connections when reading remote resources","Re-download any resource suspected of partial transfer"],"tags":["io","inputstream","truncated-stream"],"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-18T11:17:12.947Z"}