{"record":{"id":"f92f4e4c576c0905","repo":"apache/hadoop","slug":"invalid-uri-s-has-a-malformed-authority-expect","errorCode":null,"errorMessage":"Invalid URI '%s' has a malformed authority, expected container name. Authority takes the form abfs://[<container name>@]<account name>","messagePattern":"Invalid URI '(.+?)' has a malformed authority, expected container name\\. Authority takes the form abfs://\\[<container name>@\\]<account name>","errorType":"exception","errorClass":"InvalidUriException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java","lineNumber":376,"sourceCode":"    final String authority = uri.getRawAuthority();\n    if (null == authority) {\n      throw new InvalidUriAuthorityException(uri.toString());\n    }\n\n    if (!authority.contains(AbfsHttpConstants.AZURE_DISTRIBUTED_FILE_SYSTEM_AUTHORITY_DELIMITER)) {\n      throw new InvalidUriAuthorityException(uri.toString());\n    }\n\n    final String[] authorityParts = authority.split(AbfsHttpConstants.AZURE_DISTRIBUTED_FILE_SYSTEM_AUTHORITY_DELIMITER, 2);\n\n    if (authorityParts.length < 2 || authorityParts[0] != null\n        && authorityParts[0].isEmpty()) {\n      final String errMsg = String\n              .format(\"'%s' has a malformed authority, expected container name. \"\n                      + \"Authority takes the form \"\n                      + FileSystemUriSchemes.ABFS_SCHEME + \"://[<container name>@]<account name>\",\n                      uri.toString());\n      throw new InvalidUriException(errMsg);\n    }\n    return authorityParts;\n  }\n\n  /**\n   * Resolves namespace information of the filesystem from the state of {@link #isNamespaceEnabled()}.\n   * if the state is UNKNOWN, it will be determined by making a GET_ACL request\n   * to the root of the filesystem. GET_ACL call is synchronized to ensure a single\n   * call is made to determine the namespace information in case multiple threads are\n   * calling this method at the same time. The resolution of namespace information\n   * would be stored back as {@link #setNamespaceEnabled(boolean)}.\n   *\n   * @param tracingContext tracing context\n   * @return true if namespace is enabled, false otherwise.\n   * @throws AzureBlobFileSystemException server errors.\n   */\n  public boolean getIsNamespaceEnabled(TracingContext tracingContext)\n      throws AzureBlobFileSystemException {","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java#L358-L394","documentation":"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.","triggerScenarios":"Initializing the store with URIs like abfs://@myaccount.dfs.core.windows.net (empty container before '@') or abfs://data@ (nothing after '@', split yields one part).","commonSituations":"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.","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."],"exampleFix":"// before\nString uri = String.format(\"abfs://%s@%s\", containerVar, account); // containerVar renders empty\n\n// after\nPreconditions.checkArgument(containerVar != null && !containerVar.isEmpty(), \"container name required\");\nString uri = String.format(\"abfs://%s@%s\", containerVar, account);","handlingStrategy":"validation","validationCode":"String authority = uri.getRawAuthority();\nString[] parts = authority == null ? new String[0] : authority.split(\"@\", 2);\nif (parts.length < 2 || parts[0].isEmpty()) {\n  throw new IllegalArgumentException(\n      \"Expected container@account authority, got: \" + authority);\n}\nFileSystem.get(uri, conf);","typeGuard":"static boolean isAbfsAuthorityForm(String a) {\n  if (a == null) return false;\n  String[] parts = a.split(\"@\", 2);\n  return parts.length == 2 && !parts[0].isEmpty() && !parts[1].isEmpty();\n}","tryCatchPattern":"try {\n  FileSystem.get(uri, conf);\n} catch (InvalidUriException e) {\n  throw new ConfigurationException(\"Malformed authority (empty container or account): \" + uri, e);\n}","preventionTips":["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."],"tags":["azure-abfs","uri","authority","container-name","configuration"],"backgroundTag":"malformed-uri-authority","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}