{"record":{"id":"083598d39b330a4d","repo":"flowable/flowable-engine","slug":"header-line-line-is-invalid","errorCode":null,"errorMessage":"Header line '${line}' is invalid","messagePattern":"Header line '(.+?)' is invalid","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-http-common/src/main/java/org/flowable/http/common/api/HttpHeaders.java","lineNumber":162,"sourceCode":"    public static HttpHeaders parseFromString(String headersString) {\n        HttpHeaders headers = new HttpHeaders(headersString);\n\n        if (StringUtils.isNotEmpty(headersString)) {\n            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":144,"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#L144-L174","documentation":"Thrown by HttpHeaders.parseFromString when a line read from the header text can neither be parsed as a 'Name: Value' pair nor as a continuation line. The parser only accepts lines containing a colon (header field) or starting with space/tab (folded continuation); anything else is malformed. This guards the internal header model against silently dropping malformed input.","triggerScenarios":"Calling parseFromString with a header block containing a line without a colon that does not start with whitespace, e.g. 'Authorization Bearer abc' (missing colon) or stray junk text between headers.","commonSituations":"Hand-editing HTTP header text in config or test fixtures, copying headers from a log or curl transcript with mangled formatting, or generating header strings programmatically with a missing ':' separator.","solutions":["Inspect the line named in the message and add the missing colon separating header name and value","Ensure every header line follows 'Name: Value' format and continuation lines start with a space or tab","Trim stray text (request lines like 'GET / HTTP/1.1', blank-line remnants, debug output) from the string before parsing","If building headers from key/value pairs, use HttpHeaders.add(name, value) instead of parsing a formatted string"],"exampleFix":"// before\nheaders.parseFromString(\"Authorization Bearer token123\");\n// after\nheaders.parseFromString(\"Authorization: Bearer token123\");","handlingStrategy":"validation","validationCode":"// validate each header line before parsing\nfor (String line : headerText.split(\"\\\\r?\\\\n\")) {\n    if (!line.isBlank() && !line.startsWith(\" \") && !line.startsWith(\"\\t\") && !line.contains(\":\")) {\n        throw new IllegalArgumentException(\"Malformed header line (missing colon): \" + line);\n    }\n}\nhttpHeaders.parseFromString(headerText);","typeGuard":null,"tryCatchPattern":"try {\n    headers = HttpHeaders.parseFromString(headerText);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Skipping malformed header block: {}\", e.getMessage());\n    headers = new HttpHeaders();\n}","preventionTips":["Build headers with add(name, value) instead of formatting and re-parsing strings","Keep a colon between every header name and value","Strip request/status lines before parsing a header block only","Validate header text in tests/fixtures with a lint check"],"tags":["http","headers","parsing","invalid-format"],"backgroundTag":"invalid-argument-format","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"}