{"record":{"id":"46b8d02b2f29db5a","repo":"flowable/flowable-engine","slug":"io-exception-occurred-46b8d0","errorCode":null,"errorMessage":"IO exception occurred","messagePattern":"IO exception occurred","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/apache/client5/ApacheHttpComponents5FlowableHttpClient.java","lineNumber":234,"sourceCode":"                    break;\n                }\n                case \"OPTIONS\": {\n                    request = AsyncRequestBuilder.options(uri);\n                    break;\n                }\n                default: {\n                    throw new FlowableException(requestInfo.getMethod() + \" HTTP method not supported\");\n                }\n            }\n\n            setHeaders(request, requestInfo.getHttpHeaders());\n            setHeaders(request, requestInfo.getSecureHttpHeaders());\n\n            return new ApacheHttpComponentsExecutableHttpRequest(request.build(), createRequestConfig(requestInfo));\n        } catch (URISyntaxException ex) {\n            throw new FlowableException(\"Invalid URL exception occurred\", ex);\n        } catch (IOException ex) {\n            throw new FlowableException(\"IO exception occurred\", ex);\n        }\n    }\n\n    protected URI createUri(String url) throws URISyntaxException {\n        String uri = SPACE_CHARACTER_PATTERN.matcher(url).replaceAll(ENCODED_SPACE_CHARACTER);\n        return new URI(PLUS_CHARACTER_PATTERN.matcher(uri).replaceAll(ENCODED_PLUS_CHARACTER));\n    }\n\n    protected void setRequestEntity(HttpRequest requestInfo, AsyncRequestBuilder requestBase) throws UnsupportedEncodingException {\n        if (requestInfo.getBody() != null) {\n            if (StringUtils.isNotEmpty(requestInfo.getBodyEncoding())) {\n                requestBase.setEntity(AsyncEntityProducers.create(requestInfo.getBody(), Charset.forName(requestInfo.getBodyEncoding())));\n            } else {\n                requestBase.setEntity(AsyncEntityProducers.create(requestInfo.getBody()));\n            }\n        } else if (requestInfo.getBodyBytes() != null) {\n            // A caller-supplied Content-Type header (added afterwards) takes precedence over this default.\n            requestBase.setEntity(requestInfo.getBodyBytes(), ContentType.APPLICATION_OCTET_STREAM);","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/apache/client5/ApacheHttpComponents5FlowableHttpClient.java#L216-L252","documentation":"`prepareRequest` in the HttpClient 5.x client also catches `IOException` while assembling the request (e.g. building/serializing the request entity such as form or multipart bodies) and rethrows it as `FlowableException(\"IO exception occurred\", cause)`. Unlike error 3001 this fires during request preparation, not execution.","triggerScenarios":"`prepareRequest()` throws an `IOException` while setting headers/request entity — e.g. writing the multipart entity byte stream or reading body content fails during request construction.","commonSituations":"Multipart bodies backed by streams/files that disappear mid-serialization; charset encoding failures on body content; out-of-memory-style stream failures during entity building.","solutions":["Inspect the chained cause to identify the underlying stream/encoding failure.","Ensure any files/streams referenced by request bodies exist and are readable for the lifetime of the request.","For multipart requests, confirm content lengths fit memory — the client serializes the multipart entity into a byte array.","Retry transient failures only after confirming the input data is stable."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure body sources are readable and fully materialized before the call\nObjects.requireNonNull(bodyBytes, \"multipart part bytes must be non-null\");\n// charset sanity check\nCharset.forName(charsetName);","typeGuard":null,"tryCatchPattern":"try {\n    request = client.prepareRequest(requestInfo);\n} catch (FlowableException e) {\n    if (\"IO exception occurred\".equals(e.getMessage()) && e.getCause() instanceof IOException io) {\n        log.error(\"Request assembly failed: {}\", io.getMessage(), io);\n    }\n    throw e;\n}","preventionTips":["Keep backing files/streams open and readable for the whole request lifetime.","Materialize part content as String/byte[] up front.","Check charset names are valid before building entities."],"tags":["io","http-client","request-building"],"backgroundTag":"network-request-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"}