quarkusio/quarkus · error · IllegalArgumentException

Does not support fromString

Error message

Does not support fromString

What it means

ObjectToStringDelegate is the fallback HeaderDelegate that only supports converting objects to strings. Its fromString throws this IllegalArgumentException unconditionally for any non-null input because deserializing an arbitrary object from a header string is not supported. Reaching it means a header value type has no real parsing delegate registered.

Source

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

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

  1. Implement and register a HeaderDelegate<YourType> with a real fromString, or use a natively supported type (String, MediaType, NewCookie, Date, etc.).
  2. Parse the raw string yourself before constructing the typed header object.
  3. Restrict header types to ones with built-in delegates if you rely on automatic conversion.

Example fix

// before
MyEnum v = (MyEnum) delegate.fromString("VALUE_ONE"); // ObjectToStringDelegate: always throws
// after
MyEnum v = MyEnum.valueOf("VALUE_ONE"); // parse with a type-aware path or register a HeaderDelegate
Defensive patterns

Strategy: try-catch

Validate before calling

// ObjectToStringDelegate.fromString never succeeds for non-null input;
// check the type is parseable before relying on RuntimeDelegate conversion
if (!isStringLike(headerValue.getClass())) {
    throw new UnsupportedOperationException("Provide a HeaderDelegate for " + headerValue.getClass());
}

Try / catch

try {
    return delegate.fromString(raw);
} catch (IllegalArgumentException e) {
    if ("Does not support fromString".equals(e.getMessage())) {
        return parseManually(raw); // custom parsing path
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling ObjectToStringDelegate.INSTANCE.fromString(anyString), or RuntimeDelegate-based header conversion where the target type falls back to ObjectToStringDelegate (custom header class without a registered HeaderDelegate).

Common situations: Custom typed headers (enums, value objects) passed to frameworks that must parse incoming header strings; migration after removing a HeaderDelegate registration; using Object as the header generic type.

Related errors


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