quarkusio/quarkus · error · IllegalArgumentException
Param was null
Error message
Param was null
What it means
ObjectToStringDelegate is a fallback HeaderDelegate for header types with no dedicated delegate; it serializes via Objects.toString. Its fromString always throws: first a null check ('Param was null'), then unconditionally, because generic object headers cannot be deserialized back from a string. This error means you passed null to a delegate that cannot parse anyway.
Source
Thrown at independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/headers/ObjectToStringDelegate.java:13
package org.jboss.resteasy.reactive.common.headers;
import java.util.Objects;
import jakarta.ws.rs.ext.RuntimeDelegate;
public class ObjectToStringDelegate implements RuntimeDelegate.HeaderDelegate<Object> {
public static final ObjectToStringDelegate INSTANCE = new ObjectToStringDelegate();
@Override
public Object fromString(String value) {
if (value == null)
throw new IllegalArgumentException("Param was null");
throw new IllegalArgumentException("Does not support fromString");
}
@Override
public String toString(Object value) {
if (value == null)
throw new IllegalArgumentException("Param was null");
return Objects.toString(value);
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Register a proper HeaderDelegate for the header's type via RuntimeDelegate.getInstance().createHeaderDelegate or a RuntimeDelegateDecorator so fromString is supported.
- Parse the header manually with a known delegate (e.g. StringHeaderDelegate) if the type is truly String-like.
- Null-check before invoking; note that even non-null input will throw 'Does not support fromString' here.
Example fix
// before
Object v = RuntimeDelegate.getInstance().createHeaderDelegate(MyHeader.class).fromString(raw);
// after
if (raw == null) { return null; }
MyHeader v = MyHeader.parse(raw); // or register a real HeaderDelegate for MyHeader Defensive patterns
Strategy: type-guard
Validate before calling
if (rawHeader == null) {
return null; // nothing to parse
} Type guard
static <T> boolean hasRegisteredFromDelegate(Class<T> headerType) {
try {
RuntimeDelegate.getInstance().createHeaderDelegate(headerType);
return true;
} catch (IllegalArgumentException e) {
return false;
}
} Try / catch
try {
return delegate.fromString(raw);
} catch (IllegalArgumentException e) {
throw new IllegalStateException("Header type has no parsing delegate: " + e.getMessage(), e);
} Prevention
- Register HeaderDelegates for all custom header value types.
- Prefer built-in supported header types (String, MediaType, NewCookie, Date).
- Never route Object-typed values into header parsing.
- Fail fast in tests if a fallback delegate is reached for a typed header.
When it happens
Trigger: Calling ObjectToStringDelegate.INSTANCE.fromString(null), or RuntimeDelegate header parsing routed to the fallback delegate with a null string for a header type lacking a registered fromString delegate.
Common situations: Using custom header value types not registered with RuntimeDelegate; server-side parsing of a request header whose type only supports toString; generic header-processing frameworks hitting the fallback path.
Related errors
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/9edaa82465428e4e.
Report an issue: GitHub.