apache/hadoop · error · IllegalArgumentException (InvalidUriAuthorityException)

{uri} has invalid authority.

Error message

{uri} has invalid authority.

What it means

Thrown by AzureBlobFileSystem URI qualification when the final URI still has a null authority after optional reconstruction from the default filesystem URI. ABFS requires container@account in every qualified path, so an authority-less URI (e.g., abfs:///path with no abfs-schemed default URI to borrow an authority from) is rejected as IllegalArgumentException wrapping InvalidUriAuthorityException ('<uri> has invalid authority.').

Source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java:1613

      if (defaultUri != null && isAbfsScheme(defaultUri.getScheme())) {
        try {
          // Reconstruct the URI with the authority from the default URI.
          uri = new URI(
              uri.getScheme(),
              defaultUri.getAuthority(),
              uri.getPath(),
              uri.getQuery(),
              uri.getFragment());
        } catch (URISyntaxException e) {
          // This should never happen.
          throw new IllegalArgumentException(new InvalidUriException(uri.toString()));
        }
      }
    }

    if (uri.getAuthority() == null) {
      throw new IllegalArgumentException(new InvalidUriAuthorityException(uri.toString()));
    }

    return uri;
  }

  private boolean isAbfsScheme(final String scheme) {
    if (scheme == null) {
      return false;
    }

    if (scheme.equals(FileSystemUriSchemes.ABFS_SCHEME)
        || scheme.equals(FileSystemUriSchemes.ABFS_SECURE_SCHEME)) {
      return true;
    }

    return false;
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Set fs.defaultFS to a fully-qualified abfs://container@account.dfs.core.windows.net value.
  2. Use fully-qualified Path objects (abfs://container@account.dfs.core.windows.net/dir/file) in code.
  3. Verify the scheme of the default URI matches the filesystem being opened.

Example fix

// before
FileSystem fs = path.getFileSystem(conf); // path = /data/input (relative)

// after
Path qualified = new Path("abfs://data@myaccount.dfs.core.windows.net/data/input");
FileSystem fs = qualified.getFileSystem(conf);
Defensive patterns

Strategy: validation

Validate before calling

URI u = path.toUri();
if (u.getAuthority() == null) {
  URI def = new URI(conf.get("fs.defaultFS"));
  if (!"abfs".equals(def.getScheme()) && !"abfss".equals(def.getScheme())) {
    throw new IllegalStateException("No abfs authority available for " + path);
  }
}
FileSystem fs = path.getFileSystem(conf);

Type guard

static boolean hasAuthority(URI u) {
  return u.getRawAuthority() != null;
}

Try / catch

try {
  fs.open(path);
} catch (IllegalArgumentException e) {
  if (e.getCause() instanceof InvalidUriAuthorityException) {
    throw new ConfigurationException("Path lacks container@account authority: " + path, e);
  }
  throw e;
}

Prevention

When it happens

Trigger: Using relative paths or abfs:///path URIs when fs.defaultFS is absent, empty, or uses a non-abfs scheme, so no authority can be supplied during makeQualified/initialize.

Common situations: Running jobs locally without cluster core-site.xml; fs.defaultFS pointing at hdfs:// while code opens abfs:/// paths; tools that strip the authority from configured URIs.

Related errors


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