quarkusio/quarkus · warning · IllegalArgumentException

param was null

Error message

param was null

What it means

EntityTagDelegate parses an ETag header value into a javax.ws.rs.core.EntityTag. Null input is rejected with IllegalArgumentException per the HeaderDelegate contract before any W/-prefix or quote parsing.

Source

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

package org.jboss.resteasy.reactive.common.headers;

import jakarta.ws.rs.core.EntityTag;
import jakarta.ws.rs.ext.RuntimeDelegate;

/**
 * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
 */
public class EntityTagDelegate implements RuntimeDelegate.HeaderDelegate<EntityTag> {
    public static final EntityTagDelegate INSTANCE = new EntityTagDelegate();

    public EntityTag fromString(String value) throws IllegalArgumentException {
        if (value == null)
            throw new IllegalArgumentException("param was null");
        boolean weakTag = false;
        if (value.startsWith("W/")) {
            weakTag = true;
            value = value.substring(2);
        }
        if (value.startsWith("\"")) {
            value = value.substring(1);
        }
        if (value.endsWith("\"")) {
            value = value.substring(0, value.length() - 1);
        }
        return new EntityTag(value, weakTag);
    }

    public String toString(EntityTag value) {
        String weak = value.isWeak() ? "W/" : "";
        return weak + '"' + value.getValue() + '"';
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Null-check the header string before parsing
  2. Skip conditional-request logic when the ETag is missing
  3. Use Optional for the parsed EntityTag
  4. Ensure servers emit the ETag when clients depend on it

Example fix

// before
EntityTag etag = EntityTagDelegate.INSTANCE.fromString(headers.getFirst("ETag"));
// after
String v = headers.getFirst("ETag");
EntityTag etag = (v == null) ? null : EntityTagDelegate.INSTANCE.fromString(v);
Defensive patterns

Strategy: type-guard

Validate before calling

if (etagHeader == null || etagHeader.isBlank()) { /* no ETag; skip conditional logic */ }

Type guard

boolean hasEtag(String v) { return v != null && (v.startsWith("W/\"") || v.startsWith("\"")); }

Try / catch

try {
    EntityTag tag = EntityTagDelegate.INSTANCE.fromString(v);
} catch (IllegalArgumentException e) {
    // null/malformed ETag; treat as absent
}

Prevention

When it happens

Trigger: Calling EntityTagDelegate.INSTANCE.fromString(null), or framework code parsing If-None-Match/If-Match/ETag headers when the header value is null.

Common situations: Conditional request handling on clients that send no ETag; reading ETag from responses of servers that don't emit it; manual header map access returning null.

Related errors


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