apache/hadoop · critical · InvalidUriException
Invalid URI %s
Error message
Invalid URI %s
What it means
During client initialization the store builds the base service URL from scheme + authority + filesystem name and wraps it in java.net.URL. If the constructed string is not a valid absolute URL (bad scheme, illegal characters in account or container name, malformed endpoint), MalformedURLException is caught and rethrown as InvalidUriException carrying the filesystem URI. Initialization fails before any network traffic, so the mount is unusable.
Source
Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java:1837
* @param isSecure Tells if https is being used or http.
* @throws IOException
*/
private void initializeClient(URI uri, String fileSystemName,
String accountName, boolean isSecure)
throws IOException {
if (this.getClient() != null) {
return;
}
final URIBuilder uriBuilder = getURIBuilder(accountName, isSecure);
final String url = uriBuilder.toString() + AbfsHttpConstants.FORWARD_SLASH + fileSystemName;
URL baseUrl;
try {
baseUrl = new URL(url);
} catch (MalformedURLException e) {
throw new InvalidUriException(uri.toString());
}
SharedKeyCredentials creds = null;
AccessTokenProvider tokenProvider = null;
SASTokenProvider sasTokenProvider = null;
if (authType == AuthType.OAuth) {
AzureADAuthenticator.init(abfsConfiguration);
}
if (authType == AuthType.SharedKey) {
LOG.trace("Fetching SharedKey credentials");
int dotIndex = accountName.indexOf(AbfsHttpConstants.DOT);
if (dotIndex <= 0) {
throw new InvalidUriException(
uri.toString() + " - account name is not fully qualified.");
}
creds = new SharedKeyCredentials(accountName.substring(0, dotIndex),View on GitHub (pinned to 2add963021)
Solutions
- Correct fs.defaultFS to abfs://<container>@<account>.dfs.core.windows.net with a DNS-safe container name (lowercase, 3-63 chars, alphanumeric + hyphen).
- Check fs.azure.abfs.endpoint is a bare IP:PORT (no scheme) and the port is numeric.
- In a test, print new Path(fs.getUri()).toUri() or the raw config to see exactly what the builder received.
- Strip whitespace/unicode from config values; XML editors sometimes inject non-breaking spaces.
Example fix
<!-- before --> <property><name>fs.defaultFS</name><value>abfs://My_Container@acct.dfs.core.windows.net</value></property> <!-- after --> <property><name>fs.defaultFS</name><value>abfs://my-container@acct.dfs.core.windows.net</value></property>
Defensive patterns
Strategy: validation
Validate before calling
URI u = new URI(fsDefaultFS);
if (u.getAuthority() == null || u.getAuthority().split("@").length != 2) {
throw new IllegalArgumentException("fs.defaultFS must be abfs://container@account.dns: " + fsDefaultFS);
}
new URL("https", host, port, "/container"); // dry-run URL validity Try / catch
try { fs = FileSystem.get(conf); } catch (InvalidUriException e) { /* inspect fs.defaultFS authority and fs.azure.abfs.endpoint for illegal characters */ throw e; } Prevention
- Validate container/account names against Azure DNS rules (lowercase, 3-63, alnum+hyphen).
- Keep fs.azure.abfs.endpoint scheme-free.
- Add a mount smoke test (fs.getFileStatus on root) to deployment pipelines.
When it happens
Trigger: Malformed fs.defaultFS authority: container names with uppercase, underscores, or other illegal URL characters; empty account segment (abfs://@host); fs.azure.abfs.endpoint values that corrupt the host; filesystem names that are not DNS-safe.
Common situations: Typos in fs.defaultFS; container names violating Azure naming rules (3-63 chars, lowercase alphanumerics and hyphens); spaces or unicode pasted into config; endpoint config producing an invalid host/port pair.
Related errors
- URL provided is null
- "%s" must be set for user-bound SAS auth type.
- ABFS endpoint is not set correctly : %s, Do not specify sche
- Invalid URI %s - account name is not fully qualified.
- Both global key and encryption context are set, only one all
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/4e1febeb7ac7a70a.
Report an issue: GitHub.