flowable/flowable-engine · error · FlowableIllegalArgumentException

Header line ' ' is invalid

Error message

Header line '${line}' is invalid

What it means

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.

Solutions

  1. Inspect the line named in the message and add the missing colon separating header name and value
  2. Ensure every header line follows 'Name: Value' format and continuation lines start with a space or tab
  3. Trim stray text (request lines like 'GET / HTTP/1.1', blank-line remnants, debug output) from the string before parsing
  4. If building headers from key/value pairs, use HttpHeaders.add(name, value) instead of parsing a formatted string

Example fix

// before
headers.parseFromString("Authorization Bearer token123");
// after
headers.parseFromString("Authorization: Bearer token123");
Defensive patterns

Strategy: validation

Validate before calling

// validate each header line before parsing
for (String line : headerText.split("\\r?\\n")) {
    if (!line.isBlank() && !line.startsWith(" ") && !line.startsWith("\t") && !line.contains(":")) {
        throw new IllegalArgumentException("Malformed header line (missing colon): " + line);
    }
}
httpHeaders.parseFromString(headerText);

Try / catch

try {
    headers = HttpHeaders.parseFromString(headerText);
} catch (FlowableIllegalArgumentException e) {
    log.warn("Skipping malformed header block: {}", e.getMessage());
    headers = new HttpHeaders();
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/083598d39b330a4d. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-http-common/src/main/java/org/flowable/http/common/api/HttpHeaders.java:162

    public static HttpHeaders parseFromString(String headersString) {
        HttpHeaders headers = new HttpHeaders(headersString);

        if (StringUtils.isNotEmpty(headersString)) {
            try (BufferedReader reader = new BufferedReader(new StringReader(headersString))) {
                String line = reader.readLine();
                while (line != null) {
                    int colonIndex = line.indexOf(':');
                    if (colonIndex > 0) {
                        String headerName = line.substring(0, colonIndex);
                        if (line.length() > colonIndex + 2) {
                            headers.add(headerName, StringUtils.strip(line.substring(colonIndex + 1)));
                        } else {
                            headers.add(headerName, "");
                        }
                        line = reader.readLine();

                    } else {
                        throw new FlowableIllegalArgumentException("Header line '" + line + "' is invalid");
                    }
                }
            } catch (IOException ex) {
                throw new FlowableException("IO exception occurred", ex);
            }
        }

        return headers;
    }

}

View on GitHub (pinned to d6d39ce1c6)