quarkusio/quarkus · error · IllegalArgumentException
Scheme was null
Error message
Scheme was null
What it means
UriBuilderImpl.schemeSpecificPart(String ssp) throws 'Scheme was null' when the ssp argument itself is null. The message is misleading: it mentions the scheme but actually guards the scheme-specific-part parameter. The JAX-RS contract mandates IllegalArgumentException for null arguments; the method cannot parse null into authority/path/query/fragment components.
Source
Thrown at independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/jaxrs/UriBuilderImpl.java:310
if (uri.getRawPath() != null && uri.getRawPath().length() > 0) {
path = uri.getRawPath();
}
if (uri.getRawQuery() != null && uri.getRawQuery().length() > 0) {
query = uri.getRawQuery();
}
return this;
}
public UriBuilder scheme(String scheme) throws IllegalArgumentException {
this.scheme = scheme;
return this;
}
public UriBuilder schemeSpecificPart(String ssp) throws IllegalArgumentException {
if (ssp == null)
throw new IllegalArgumentException("Scheme was null");
StringBuilder sb = new StringBuilder();
if (scheme != null)
sb.append(scheme).append(':');
if (ssp != null)
sb.append(ssp);
if (fragment != null && fragment.length() > 0)
sb.append('#').append(fragment);
URI uri = URI.create(sb.toString());
if (uri.getRawSchemeSpecificPart() != null && uri.getRawPath() == null) {
this.ssp = uri.getRawSchemeSpecificPart();
} else {
this.ssp = null;
userInfo = uri.getRawUserInfo();
host = uri.getHost();
port = uri.getPort();
path = uri.getRawPath();View on GitHub (pinned to e1c734241f)
Solutions
- Do not pass null: check the string before calling or skip the call when null
- Fail fast with Objects.requireNonNull(ssp, 'ssp') at your call site
- If optional, skip: if (ssp != null) builder.schemeSpecificPart(ssp);
- Remember the message text is misleading - validate the ssp argument, not the builder scheme
Example fix
// before: builder.schemeSpecificPart(ssp); // throws if ssp null // after: if (ssp != null) { builder.schemeSpecificPart(ssp); } Defensive patterns
Strategy: type-guard
Validate before calling
if (ssp == null) {
throw new IllegalArgumentException('scheme-specific part must not be null');
} Type guard
static boolean hasSsp(String ssp) {
return ssp != null && !ssp.isEmpty();
} Try / catch
try {
builder.schemeSpecificPart(ssp);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException('schemeSpecificPart argument was null (message text is misleading)', e);
} Prevention
- Never pass null; skip the call or pass an empty string
- Remember the message says Scheme was null but the ssp argument is the real problem
- Guard generated/deserialized strings before passing them in
When it happens
Trigger: Calling schemeSpecificPart(null) directly, or passing a String variable that was never initialized or that a lookup returned as null.
Common situations: Generated or reflective code calling schemeSpecificPart with an absent field; deserialized objects with null ssp; copy-paste of the uri(URI) null-check pattern where the guard was expected elsewhere.
Related errors
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/2a8bd252d4800aa4.
Report an issue: GitHub.