{"record":{"id":"fc3002b2d2bd3675","repo":"flowable/flowable-engine","slug":"io-exception-occurred","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/api/HttpHeaders.java","lineNumber":166,"sourceCode":"            try (BufferedReader reader = new BufferedReader(new StringReader(headersString))) {\n                String line = reader.readLine();\n                while (line != null) {\n                    int colonIndex = line.indexOf(':');\n                    if (colonIndex > 0) {\n                        String headerName = line.substring(0, colonIndex);\n                        if (line.length() > colonIndex + 2) {\n                            headers.add(headerName, StringUtils.strip(line.substring(colonIndex + 1)));\n                        } else {\n                            headers.add(headerName, \"\");\n                        }\n                        line = reader.readLine();\n\n                    } else {\n                        throw new FlowableIllegalArgumentException(\"Header line '\" + line + \"' is invalid\");\n                    }\n                }\n            } catch (IOException ex) {\n                throw new FlowableException(\"IO exception occurred\", ex);\n            }\n        }\n\n        return headers;\n    }\n\n}\n","sourceCodeStart":148,"sourceCodeEnd":174,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-http-common/src/main/java/org/flowable/http/common/api/HttpHeaders.java#L148-L174","documentation":"Wrapped FlowableException thrown when reading the header text via BufferedReader.readLine() raises an IOException during HttpHeaders.parseFromString. The original IOException is preserved as the cause. It indicates the underlying character source (reader/stream) failed mid-read, not a parsing problem.","triggerScenarios":"parseFromString is given a Reader backed by a socket, file, or stream that fails while reading (connection reset, file IO error, closed stream).","commonSituations":"Parsing headers read directly from a flaky network connection, a file that was truncated/deleted mid-read, or a stream already closed by another component.","solutions":["Check the cause (ex.getCause()) for the real IOException and fix the underlying source","Verify the input stream/file is readable and not closed before calling parseFromString","Read the header text fully into a String first (e.g. with a safe read loop) and pass the String, so IO errors surface before parsing","Add retry/reconnect logic around the source if it is a network stream"],"exampleFix":"// before\nhttpHeaders.parseFromString(new FileReader(maybeMissingFile));\n// after\nString text = Files.readString(Path.of(\"headers.txt\"));\nhttpHeaders.parseFromString(text);","handlingStrategy":"try-catch","validationCode":"// ensure the source is fully readable before parsing\nString headerText;\ntry (BufferedReader r = new BufferedReader(reader)) {\n    headerText = r.lines().collect(Collectors.joining(\"\\n\"));\n} catch (IOException e) {\n    throw new IllegalStateException(\"Cannot read header source\", e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    headers = HttpHeaders.parseFromString(reader);\n} catch (FlowableException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof IOException) {\n        // retry or reconnect to the underlying source\n    }\n    throw e;\n}","preventionTips":["Pass in-memory Strings rather than live network streams when possible","Check stream/file availability before parsing","Always inspect getCause() for the real IO failure","Add retry logic for network-backed readers"],"tags":["io","network","http","headers"],"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"}