quarkusio/quarkus · error · IllegalArgumentException

Name is null

Error message

Name is null

What it means

UriBuilder.resolveTemplate(String, Object) throws IllegalArgumentException when the template variable name is null. The name identifies a {placeholder} in the URI template, so it must be a non-null string per the JAX-RS contract.

Source

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

            return this;
        }
        this.path = Encode.encodePath(path);
        return this;
    }

    public URI build(Object[] values, boolean encodeSlashInPath) throws IllegalArgumentException, UriBuilderException {
        if (values == null)
            throw new IllegalArgumentException("Values is null");
        return buildFromValues(encodeSlashInPath, false, values);
    }

    public String toTemplate() {
        return buildString(new HashMap<String, Object>(), true, true, true);
    }

    public UriBuilder resolveTemplate(String name, Object value) throws IllegalArgumentException {
        if (name == null)
            throw new IllegalArgumentException("Name is null");
        if (value == null)
            throw new IllegalArgumentException("Value is null");
        HashMap<String, Object> vals = new HashMap<String, Object>();
        vals.put(name, value);
        return resolveTemplates(vals);
    }

    public UriBuilder resolveTemplates(Map<String, Object> templateValues) throws IllegalArgumentException {
        if (templateValues == null)
            throw new IllegalArgumentException("Template values null");
        if (templateValues.containsKey(null))
            throw new IllegalArgumentException("map key null");
        return uriTemplate(buildCharSequence(templateValues, false, true, true));
    }

    public UriBuilder resolveTemplate(String name, Object value, boolean encodeSlashInPath) throws IllegalArgumentException {
        if (name == null)
            throw new IllegalArgumentException("Name is null");

View on GitHub (pinned to e1c734241f)

Solutions

  1. Pass the correct non-null template variable name
  2. Validate/require the name before calling resolveTemplate
  3. If the name is optional, skip that substitution or use a default name

Example fix

// before
builder.resolveTemplate(name, value); // name == null
// after
if (name != null) {
    builder.resolveTemplate(name, value);
}
Defensive patterns

Strategy: validation

Validate before calling

Objects.requireNonNull(name, "template variable name must not be null");
uriBuilder.resolveTemplate(name, value);

Type guard

boolean isValidTemplateArg(String name, Object value) {
    return name != null && value != null;
}

Try / catch

try {
    return uriBuilder.resolveTemplate(name, value);
} catch (IllegalArgumentException e) {
    throw new IllegalArgumentException("resolveTemplate(name=" + name + ") rejected: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Calling uriBuilder.resolveTemplate(null, value), typically when the template name comes from an annotation attribute, a map key, or a constant that failed to initialize.

Common situations: Names read from configuration or metadata that is missing; iterating over Map.Entry sets where a key is null; dynamic template names built from other data.

Related errors


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