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

  1. Use fully-qualified URIs of the form abfs://container@account.dfs.core.windows.net/path.
  2. Verify fs.defaultFS / job configuration actually contains the account host before creating the FileSystem.
  3. 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

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


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/f989646045c2f6a1. Report an issue: GitHub.