quarkusio/quarkus · error · IllegalArgumentException

No end to parameter

Error message

No end to parameter

What it means

LinkDelegate parses an RFC 5988 Link header into a jakarta.ws.rs.core.Link. Its internal Parser.parseAttribute() extracts each `name=value` parameter and throws IllegalArgumentException when it cannot find a terminating '=' followed by at least one more character, i.e. the parameter name is dangling with no '=' or the '=' is the last character of the header value.

Source

Thrown at independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/LinkDelegate.java:90

                        builder.param(name, val);

                }
            }
        }

        public String parseLink() {
            int end = value.indexOf('>', curr);
            if (end == -1)
                throw new IllegalArgumentException("No end to link");
            String href = value.substring(curr + 1, end);
            curr = end + 1;
            return href;
        }

        public void parseAttribute(MultivaluedMap<String, String> attributes) {
            int end = value.indexOf('=', curr);
            if (end == -1 || end + 1 >= value.length())
                throw new IllegalArgumentException("No end to parameter");
            String name = value.substring(curr, end);
            name = name.trim();
            curr = end + 1;
            String val = null;
            if (curr >= value.length()) {
                val = "";
            } else {

                if (value.charAt(curr) == '"') {
                    if (curr + 1 >= value.length())
                        throw new IllegalArgumentException("No end to parameter");
                    curr++;
                    end = value.indexOf('"', curr);
                    if (end == -1)
                        throw new IllegalArgumentException("No end to parameter");
                    val = value.substring(curr, end);
                    curr = end + 1;
                } else {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the raw Link header string and ensure every parameter is of the form name=value (e.g. rel="next", title="foo").
  2. Fix the code generating the header so it emits '=' followed by a value for each parameter; trim trailing '; ' or dangling keys.
  3. Escape/quote values containing spaces or '=' as required by RFC 5988 before serializing.
  4. Wrap header parsing in try-catch for IllegalArgumentException and fall back to treating the header as unusable rather than failing the request.

Example fix

// before
String header = "<https://api.example.com/page/2>; rel";
Link link = Link.valueOf(header); // throws
// after
String header = "<https://api.example.com/page/2>; rel=\"next\"";
Link link = Link.valueOf(header);
Defensive patterns

Strategy: validation

Validate before calling

boolean isParsableLink(String h) {
    if (h == null) return false;
    for (String param : h.split(";")) {
        String p = param.trim();
        if (p.isEmpty() || p.startsWith("<")) continue;
        if (p.indexOf('=') <= 0 || p.indexOf('=') == p.length() - 1) return false;
    }
    return true;
}

Try / catch

try {
    Link link = Link.valueOf(header);
} catch (IllegalArgumentException e) {
    log.warn("Malformed Link header: " + header, e);
    // proceed without link
}

Prevention

When it happens

Trigger: Parsing a Link header (via LinkDelegate.fromString, Link.valueOf, or header deserialization) where a parameter after the first '; ' lacks an '=' (e.g. `<http://x>; rel`), or has an '=' as the final character (e.g. `<http://x>; rel=`).

Common situations: Hand-written or mis-generated Link/Set-Cookie-style headers from proxies or custom clients; truncated headers; server code building Link strings manually with a formatting bug; header values stripped by middleware.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/c1bf6e427444a53a. Report an issue: GitHub.