apache/dubbo · error · IllegalStateException
url missing protocol: "${fullURLStr}"
Error message
url missing protocol: "${fullURLStr}" What it means
Thrown by URLStrParser.parseURLBody as an IllegalStateException when the URL string contains the '://' separator at position 0, i.e. the protocol segment before '://' is empty. The parser cannot determine a protocol, so it rejects the malformed URL rather than guessing.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/common/URLStrParser.java:114
/**
* @param fullURLStr : fullURLString
* @param decodedBody : format: [protocol://][username:password@][host:port]/[path]
* @param parameters :
* @return URL
*/
private static URL parseURLBody(String fullURLStr, String decodedBody, Map<String, String> parameters) {
int starIdx = 0, endIdx = decodedBody.length();
// ignore the url content following '#'
int poundIndex = decodedBody.indexOf('#');
if (poundIndex != -1) {
endIdx = poundIndex;
}
String protocol = null;
int protoEndIdx = decodedBody.indexOf("://");
if (protoEndIdx >= 0) {
if (protoEndIdx == 0) {
throw new IllegalStateException("url missing protocol: \"" + fullURLStr + "\"");
}
protocol = decodedBody.substring(0, protoEndIdx);
starIdx = protoEndIdx + 3;
} else {
// case: file:/path/to/file.txt
protoEndIdx = decodedBody.indexOf(":/");
if (protoEndIdx >= 0) {
if (protoEndIdx == 0) {
throw new IllegalStateException("url missing protocol: \"" + fullURLStr + "\"");
}
protocol = decodedBody.substring(0, protoEndIdx);
starIdx = protoEndIdx + 1;
}
}
String path = null;
int pathStartIdx = indexOf(decodedBody, '/', starIdx, endIdx);
if (pathStartIdx >= 0) {View on GitHub (pinned to 3a3043227f)
Solutions
- Supply a non-empty protocol before '://' in the URL string (e.g. 'dubbo://', 'nacos://', 'zookeeper://').
- Fix the config interpolation so the protocol variable resolves to a real value in the active profile.
- Validate URL strings before parsing: assert they match <nonempty>:// before passing to URLStrParser.
Example fix
// before String u = "://" + host + ":" + port + "/" + path; // protocol empty -> throws // after String u = protocol + "://" + host + ":" + port + "/" + path; // protocol non-empty
Defensive patterns
Strategy: validation
Validate before calling
// Validate the URL shape before parsing
if (url == null || url.startsWith("://") || (url.contains("://") && url.indexOf("://") == 0)) {
throw new IllegalArgumentException("url missing protocol: " + url);
}
URL parsed = URLStrParser.parseURL(url); Prevention
- Ensure config placeholders for the protocol (e.g. ${protocol}) resolve in every profile.
- Validate URL strings match <nonempty>:// at config load time.
- Build URLs by concatenation only with a guaranteed non-empty protocol constant.
When it happens
Trigger: Parsing a URL string that starts with '://' (e.g. "://host:port/path") via URLStrParser / valueOf paths; a URL built by concatenation where the protocol variable was empty before '://'; a config placeholder for the protocol that resolved to empty string.
Common situations: Config templating where ${protocol} is unset and yields '://host...'; string concatenation building a URL with an empty protocol field; copy-paste removing the protocol; environment/profile that fails to inject the protocol variable; malformed registry/address strings parsed at startup.
Related errors
- Invalid url, password without username!
- Invalid url, password without username!
- The address of metadata report is invalid.
- Invalid configurator rule, please specify at least one param
- service field in configuration is null.
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/04833a4ecb51fe2b.
Report an issue: GitHub.