apache/hadoop · error · InvalidUriException
Invalid URI '%s' has a malformed authority, expected contain
Error message
Invalid URI '%s' has a malformed authority, expected container name. Authority takes the form abfs://[<container name>@]<account name>
What it means
Thrown by AzureBlobFileSystemStore.authorityParts when the authority contains '@' but splits into fewer than two usable parts, or the container part before '@' is empty — e.g., abfs://@account (empty container) or an authority ending in '@'. The resulting InvalidUriException spells out the expected form: abfs://[<container name>@]<account name>. Initialization stops before any service call.
Source
Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java:376
final String authority = uri.getRawAuthority();
if (null == authority) {
throw new InvalidUriAuthorityException(uri.toString());
}
if (!authority.contains(AbfsHttpConstants.AZURE_DISTRIBUTED_FILE_SYSTEM_AUTHORITY_DELIMITER)) {
throw new InvalidUriAuthorityException(uri.toString());
}
final String[] authorityParts = authority.split(AbfsHttpConstants.AZURE_DISTRIBUTED_FILE_SYSTEM_AUTHORITY_DELIMITER, 2);
if (authorityParts.length < 2 || authorityParts[0] != null
&& authorityParts[0].isEmpty()) {
final String errMsg = String
.format("'%s' has a malformed authority, expected container name. "
+ "Authority takes the form "
+ FileSystemUriSchemes.ABFS_SCHEME + "://[<container name>@]<account name>",
uri.toString());
throw new InvalidUriException(errMsg);
}
return authorityParts;
}
/**
* Resolves namespace information of the filesystem from the state of {@link #isNamespaceEnabled()}.
* if the state is UNKNOWN, it will be determined by making a GET_ACL request
* to the root of the filesystem. GET_ACL call is synchronized to ensure a single
* call is made to determine the namespace information in case multiple threads are
* calling this method at the same time. The resolution of namespace information
* would be stored back as {@link #setNamespaceEnabled(boolean)}.
*
* @param tracingContext tracing context
* @return true if namespace is enabled, false otherwise.
* @throws AzureBlobFileSystemException server errors.
*/
public boolean getIsNamespaceEnabled(TracingContext tracingContext)
throws AzureBlobFileSystemException {View on GitHub (pinned to 2add963021)
Solutions
- Supply a real container name before the '@': abfs://data@myaccount.dfs.core.windows.net.
- Check templated/interpolated config values actually resolve to non-empty.
- Validate the authority with a split('@') guard before opening the filesystem.
Example fix
// before
String uri = String.format("abfs://%s@%s", containerVar, account); // containerVar renders empty
// after
Preconditions.checkArgument(containerVar != null && !containerVar.isEmpty(), "container name required");
String uri = String.format("abfs://%s@%s", containerVar, account); Defensive patterns
Strategy: validation
Validate before calling
String authority = uri.getRawAuthority();
String[] parts = authority == null ? new String[0] : authority.split("@", 2);
if (parts.length < 2 || parts[0].isEmpty()) {
throw new IllegalArgumentException(
"Expected container@account authority, got: " + authority);
}
FileSystem.get(uri, conf); Type guard
static boolean isAbfsAuthorityForm(String a) {
if (a == null) return false;
String[] parts = a.split("@", 2);
return parts.length == 2 && !parts[0].isEmpty() && !parts[1].isEmpty();
} Try / catch
try {
FileSystem.get(uri, conf);
} catch (InvalidUriException e) {
throw new ConfigurationException("Malformed authority (empty container or account): " + uri, e);
} Prevention
- Fail fast on unresolved config interpolation (empty ${container} variables).
- Add a URI-shape assertion wherever authorities are assembled programmatically.
- Include an authority-format unit test for config builders.
When it happens
Trigger: Initializing the store with URIs like abfs://@myaccount.dfs.core.windows.net (empty container before '@') or abfs://data@ (nothing after '@', split yields one part).
Common situations: Templated URIs where the container variable renders empty; string concatenation building the authority with a missing container name; config interpolation (e.g., ${container}@account) with the variable undefined.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- {uri} has invalid authority.
- %s has invalid authority.
- Uri without authority: {uri}
- {uri}
- Bad configuration of hadoop.security.key.provider.path at ${
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/f92f4e4c576c0905.
Report an issue: GitHub.