quarkusio/quarkus · error · IllegalArgumentException

param was null

Error message

param was null

What it means

LinkBuilderImpl.rel() throws IllegalArgumentException when the rel parameter is null. Per JAX-RS, a link relation cannot be null, so the builder rejects it eagerly instead of producing an invalid Link.

Source

Thrown at independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/LinkBuilderImpl.java:61

    public Link.Builder uri(URI uri) {
        if (uri == null)
            throw new IllegalArgumentException("URI was null");
        uriBuilder = UriBuilder.fromUri(uri);
        return this;
    }

    @Override
    public Link.Builder uri(String uri) throws IllegalArgumentException {
        if (uri == null)
            throw new IllegalArgumentException("URI was null");
        uriBuilder = UriBuilder.fromUri(uri);
        return this;
    }

    @Override
    public Link.Builder rel(String rel) {
        if (rel == null)
            throw new IllegalArgumentException("param was null");
        final String rels = this.map.get(Link.REL);
        param(Link.REL, rels == null ? rel : rels + " " + rel);
        return this;
    }

    @Override
    public Link.Builder title(String title) {
        if (title == null)
            throw new IllegalArgumentException("param was null");
        param(Link.TITLE, title);
        return this;

    }

    @Override
    public Link.Builder type(String type) {
        if (type == null)
            throw new IllegalArgumentException("param was null");

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the rel value is non-null before calling rel(); substitute a default like "self" if absent.
  2. Check the source of the relation string (config/annotations/headers) for missing values.
  3. Wrap in an explicit null check and skip rel() when absent.

Example fix

// before
Link link = Link.fromUri(uri).rel(unknownRel).build();
// after
Link.Builder b = Link.fromUri(uri);
if (unknownRel != null) b.rel(unknownRel);
Link link = b.build();
Defensive patterns

Strategy: validation

Validate before calling

if (rel == null || rel.isBlank()) throw new IllegalArgumentException("rel must be non-null");

Type guard

boolean isValidRel(String rel) { return rel != null && !rel.isBlank(); }

Try / catch

try { builder.rel(rel); } catch (IllegalArgumentException e) { log.warn("null rel", e); }

Prevention

When it happens

Trigger: Calling Link.fromUri(...).rel(null) or a builder variable holding a null relation computed at runtime.

Common situations: Relation type read from config, a map, or an annotation attribute that was never populated; refactoring that made a constant nullable.

Related errors


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