quarkusio/quarkus · error · IllegalArgumentException

Values parameter is null

Error message

Values parameter is null

What it means

UriBuilderImpl.buildFromMap(Map) requires a non-null map of URI template variables; a null map is rejected with this IllegalArgumentException before template resolution begins. The JAX-RS UriBuilder API treats a null values map as a programming error rather than an empty substitution set.

Source

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

     * Only replace path params in path of URI. This changes state of URIBuilder.
     *
     * @param name parameter name
     * @param value parameter value
     * @param isEncoded encoded flag
     * @return uri builder
     */
    public UriBuilder substitutePathParam(String name, Object value, boolean isEncoded) {
        if (path != null) {
            StringBuilder builder = new StringBuilder();
            replacePathParameter(name, value.toString(), isEncoded, path, builder, false);
            path = builder.toString();
        }
        return this;
    }

    public URI buildFromMap(Map<String, ? extends Object> values) throws IllegalArgumentException, UriBuilderException {
        if (values == null)
            throw new IllegalArgumentException("Values parameter is null");
        return buildUriFromMap(values, false, true);
    }

    public URI buildFromEncodedMap(Map<String, ? extends Object> values) throws IllegalArgumentException, UriBuilderException {
        if (values == null)
            throw new IllegalArgumentException("Values parameter is null");
        return buildUriFromMap(values, true, false);
    }

    public URI buildFromMap(Map<String, ?> values, boolean encodeSlashInPath)
            throws IllegalArgumentException, UriBuilderException {
        if (values == null)
            throw new IllegalArgumentException("Values parameter is null");
        return buildUriFromMap(values, false, encodeSlashInPath);
    }

    protected URI buildUriFromMap(Map<String, ? extends Object> paramMap, boolean fromEncodedMap, boolean encodeSlash)
            throws IllegalArgumentException, UriBuilderException {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Pass an empty map (Map.of() / Collections.emptyMap()) when there are no template values.
  2. Null-check or default the map before the call: values == null ? Map.of() : values.
  3. Fix the upstream code that produces the null map.
  4. Alternatively call build() with positional values if you have no named parameters.

Example fix

// before
URI uri = builder.buildFromMap(params); // params null
// after
URI uri = builder.buildFromMap(params != null ? params : Map.of());
Defensive patterns

Strategy: validation

Validate before calling

Map<String, Object> safeValues = values == null ? Map.of() : values;
URI uri = builder.buildFromMap(safeValues);

Type guard

static <V> Map<String, V> nullSafe(Map<String, V> m) {
    return m == null ? Map.of() : m;
}

Try / catch

try {
    uri = builder.buildFromMap(values);
} catch (IllegalArgumentException e) {
    if (e.getMessage().equals("Values parameter is null")) {
        uri = builder.build();
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling buildFromMap(null) or passing a Map variable that is null because an upstream lookup/parse produced no map.

Common situations: Deserializing template parameters from JSON/config that came back null; a method parameter threaded through several layers and left unset; frameworks that pass null to mean 'no params' (use an empty map instead).

Related errors


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