quarkusio/quarkus · error · IllegalArgumentException
path is null
Error message
path is null
What it means
UriBuilderImpl.path(String) throws 'path is null' when the segment argument is null. The JAX-RS UriBuilder contract requires IllegalArgumentException for null path arguments. The segment is appended to the internal path list via paths(), which cannot accept null. Passing an empty string is allowed.
Solutions
- Check for null before calling: if (segment != null) builder.path(segment);
- Default optional path config to an empty string instead of null
- Fail fast with Objects.requireNonNull(segment, 'segment') at your call site
- Trace where the null originated (config/lookup) and fix the source
Example fix
// before: builder.path(config.basePath()); // throws if null // after: String p = config.basePath(); builder.path(p != null ? p : "");
Defensive patterns
Strategy: type-guard
Validate before calling
if (segment == null) {
throw new IllegalArgumentException('path segment must not be null');
} Type guard
static boolean hasPath(String segment) {
return segment != null;
} Try / catch
try {
builder.path(segment);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException('path segment was null; check config/annotation lookup', e);
} Prevention
- Default optional path config to an empty string instead of null
- Skip the path() call when the segment is null
- Fail fast with Objects.requireNonNull where the segment is produced
When it happens
Trigger: Calling builder.path(null) or path(variable) where the variable is null - e.g. an optional path config value absent, a map.get() miss, or a lookup that returned null.
Common situations: Reading a path fragment from absent configuration; an earlier null propagating through path concatenation; test code passing null to probe error handling.
Related errors
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/14c65e7fa3507368.
Report an issue: GitHub.
Appendix: source
Thrown at independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/UriBuilderImpl.java:394
} else {
if (encode)
segment = Encode.encodePath(segment);
if ("".equals(path)) {
path = segment;
} else if (segment.startsWith("/")) {
path += segment;
} else {
path += "/" + segment;
}
}
}
return path;
}
public UriBuilder path(String segment) throws IllegalArgumentException {
if (segment == null)
throw new IllegalArgumentException("path is null");
path = paths(encode, path, segment);
return this;
}
@SuppressWarnings("unchecked")
public UriBuilder path(Class resource) throws IllegalArgumentException {
if (resource == null)
throw new IllegalArgumentException("path is null");
Path ann = (Path) resource.getAnnotation(Path.class);
if (ann != null) {
String[] segments = new String[] { ann.value() };
path = paths(true, path, segments);
} else {
throw new IllegalArgumentException("class must be annotated with @Path");
}
return this;
}
View on GitHub (pinned to e1c734241f)