apache/dubbo · error · IllegalArgumentException
url == null
Error message
url == null
What it means
Thrown by UrlUtils.valueOf(String url) when the url argument is null or empty after trimming. This method parses a raw Dubbo URL string (protocol://user:password@host:port/path?params) into a URL instance. A null/blank URL means the caller has no valid endpoint string.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java:610
arr[2] = serviceKey.substring(j + 1);
serviceKey = serviceKey.substring(0, j);
}
arr[1] = serviceKey;
return arr;
}
/**
* NOTICE: This method allocate too much objects, we can use {@link URLStrParser#parseDecodedStr(String)} instead.
* <p>
* Parse url string
*
* @param url URL string
* @return URL instance
* @see URL
*/
public static URL valueOf(String url) {
if (url == null || (url = url.trim()).length() == 0) {
throw new IllegalArgumentException("url == null");
}
String protocol = null;
String username = null;
String password = null;
String host = null;
int port = 0;
String path = null;
Map<String, String> parameters = null;
int i = url.indexOf('?'); // separator between body and parameters
if (i >= 0) {
String[] parts = url.substring(i + 1).split("&");
parameters = new HashMap<>();
for (String part : parts) {
part = part.trim();
if (part.length() > 0) {
int j = part.indexOf('=');
if (j >= 0) {
String key = part.substring(0, j);View on GitHub (pinned to 3a3043227f)
Solutions
- Null/empty-check before calling: if (url != null && !url.trim().isEmpty()) { UrlUtils.valueOf(url); }.
- Trace the source of the URL string — check cache, config, or deserialization logic.
- Prefer URLStrParser.parseDecodedStr as the method's Javadoc suggests for efficiency.
Example fix
// before
URL u = UrlUtils.valueOf(cachedUrlStr);
// after
if (cachedUrlStr == null || cachedUrlStr.trim().isEmpty()) {
throw new IllegalStateException("URL string is missing");
}
URL u = UrlUtils.valueOf(cachedUrlStr); Defensive patterns
Strategy: validation
Validate before calling
if (url == null || url.trim().isEmpty()) {
throw new IllegalStateException("URL string is missing or blank");
}
URL parsed = UrlUtils.valueOf(url); Prevention
- Null-check URL strings loaded from cache, config, or deserialization before parsing.
- Consider using URLStrParser.parseDecodedStr for better performance as the Javadoc suggests.
When it happens
Trigger: Calling UrlUtils.valueOf(null) or UrlUtils.valueOf(""); the URL string was loaded from a deserialized object, cache, or config that returned null/empty; URL passed from a query parameter that was absent.
Common situations: Deserialization of a cached URL string that expired or was never set; URL read from a URLStrParser result that returned null; configuration property for a provider/consumer URL not set.
Related errors
- unterminated escape sequence at index ${i} of: ${str}
- object is null
- Address is not allowed to be empty, please re-enter.
- Addresses is not allowed to be empty, please re-enter.
- unable to determine bean class from factory's superclass or
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/be2be48cab62625b.
Report an issue: GitHub.