apache/hadoop · error · InvalidUriException
URL provided is null
Error message
URL provided is null
What it means
createRequestUrl was called with a null base URL. The account endpoint URL that should prefix every request was never established, so no request URL can be built. This is an initialization/configuration defect rather than a service error.
Source
Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsClient.java:1234
* @param path for which URL has to be created.
* @param query to be added to the URL.
* @return URL for the REST operation.
* @throws AzureBlobFileSystemException if URL creation fails.
*/
@VisibleForTesting
protected URL createRequestUrl(final URL baseUrl, final String path, final String query)
throws AzureBlobFileSystemException {
String encodedPath = path;
try {
encodedPath = urlEncode(path);
} catch (AzureBlobFileSystemException ex) {
LOG.debug("Unexpected error.", ex);
throw new InvalidUriException(path);
}
final StringBuilder sb = new StringBuilder();
if (baseUrl == null) {
throw new InvalidUriException("URL provided is null");
}
sb.append(baseUrl.toString());
sb.append(encodedPath);
sb.append(query);
final URL url;
try {
url = new URL(sb.toString());
} catch (MalformedURLException ex) {
throw new InvalidUriException("URL is malformed" + sb.toString());
}
return url;
}
/**
* returns the url encoded string for a given value.
* @param value to be encoded.
* @return url encoded string.View on GitHub (pinned to 2add963021)
Solutions
- Use fully-qualified URIs of the form abfs://container@account.dfs.core.windows.net/path.
- Verify fs.defaultFS / job configuration actually contains the account host before creating the FileSystem.
- If constructing clients programmatically, ensure the base URL field is initialized from configuration before any request is attempted.
Example fix
# before
FileSystem fs = FileSystem.get(new URI("abfs://data/"), conf); # no account host
# after
FileSystem fs = FileSystem.get(
new URI("abfs://data@myaccount.dfs.core.windows.net/"), conf); Defensive patterns
Strategy: validation
Validate before calling
URI u = new URI(userUrl);
if (u.getHost() == null || u.getAuthority() == null) {
throw new IllegalArgumentException("URI must include account host: " + userUrl);
} Try / catch
catch (InvalidUriException ex) {
if ("URL provided is null".equals(ex.getMessage())) {
// base endpoint unresolved: fix URI/config before retrying
} else throw ex;
} Prevention
- Always use fully-qualified abfs://container@account.dfs.core.windows.net URIs.
- Set fs.defaultFS correctly when relative paths are used.
- Fail fast at startup if the filesystem URI has no authority.
When it happens
Trigger: The AbfsClient was constructed without resolving an account base URL — typically a malformed filesystem URI (missing account host, e.g. abfs://container/ with no authority) or code constructing the client directly instead of through AzureBlobFileSystemStore initialization.
Common situations: Relative URIs relying on fs.defaultFS that is itself unset; configuration assembled dynamically where the account host is dropped; test harnesses instantiating client objects with null baseUrl.
Related errors
- Invalid URI %s
- "%s" must be set for user-bound SAS auth type.
- %s has invalid authority.
- ABFS endpoint is not set correctly : %s, Do not specify sche
- Invalid URI %s - account name is not fully qualified.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/f989646045c2f6a1.
Report an issue: GitHub.