quarkusio/quarkus · error · IllegalArgumentException
param was null
Error message
param was null
What it means
NewCookieHeaderDelegate.fromString parses a Set-Cookie header string into a NewCookie and rejects null input per the JAX-RS HeaderDelegate contract. A null string cannot represent a cookie, so an IllegalArgumentException is thrown before any parsing starts.
Source
Thrown at independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/NewCookieHeaderDelegate.java:25
import java.util.Map;
import jakarta.ws.rs.core.NewCookie;
import jakarta.ws.rs.ext.RuntimeDelegate;
import org.jboss.resteasy.reactive.common.util.DateUtil;
import org.jboss.resteasy.reactive.common.util.OrderedParameterParser;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class NewCookieHeaderDelegate implements RuntimeDelegate.HeaderDelegate {
public static final NewCookieHeaderDelegate INSTANCE = new NewCookieHeaderDelegate();
private static final String OLD_COOKIE_PATTERN = "EEE, dd-MMM-yyyy HH:mm:ss z";
public Object fromString(String newCookie) throws IllegalArgumentException {
if (newCookie == null)
throw new IllegalArgumentException("param was null");
String cookieName = null;
String cookieValue = null;
String comment = null;
String domain = null;
int maxAge = NewCookie.DEFAULT_MAX_AGE;
String path = null;
boolean secure = false;
int version = NewCookie.DEFAULT_VERSION;
boolean httpOnly = false;
NewCookie.SameSite sameSite = null;
Date expiry = null;
OrderedParameterParser parser = new OrderedParameterParser();
Map<String, String> map = parser.parse(newCookie, ';');
for (Map.Entry<String, String> entry : map.entrySet()) {
String name = entry.getKey();
String value = entry.getValue();View on GitHub (pinned to e1c734241f)
Solutions
- Null-check the cookie string before parsing and treat null as 'no cookie'.
- Use a MultiValueMap/headers API that returns an empty list, and branch on isEmpty before conversion.
- Catch IllegalArgumentException when the cookie string is genuinely optional.
Example fix
// before NewCookie c = (NewCookie) NewCookieHeaderDelegate.INSTANCE.fromString(header); // after NewCookie c = header == null ? null : (NewCookie) NewCookieHeaderDelegate.INSTANCE.fromString(header);
Defensive patterns
Strategy: type-guard
Validate before calling
if (cookieHeader == null || cookieHeader.isEmpty()) {
return null; // no cookie present
} Type guard
static boolean hasCookie(String setCookieHeader) {
return setCookieHeader != null && !setCookieHeader.isBlank();
} Try / catch
try {
return (NewCookie) NewCookieHeaderDelegate.INSTANCE.fromString(raw);
} catch (IllegalArgumentException e) {
return null; // null or unparseable cookie
} Prevention
- Check header maps for presence before converting Set-Cookie values.
- Model 'absent cookie' explicitly (Optional/empty list) instead of passing null.
- Trim and validate cookie strings obtained from upstream proxies.
- Unit-test the no-cookie path of any proxying/forwarding code.
When it happens
Trigger: Calling NewCookieHeaderDelegate.fromString(null) directly, or feeding a null header value (e.g. missing Set-Cookie from a response map lookup) into RuntimeDelegate cookie conversion.
Common situations: Proxying/forwarding cookies where the upstream response had no Set-Cookie header; reading cookies from a Map.get that returned null; optional config values for default cookies.
Related errors
- Param was null
- Media type was null
- Param was null
- Does not support fromString
- control character in cookie value
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/fc143102aba02235.
Report an issue: GitHub.