{"record":{"id":"b7e63595792accd3","repo":"apache/hadoop","slug":"s-has-invalid-authority","errorCode":null,"errorMessage":"%s has invalid authority.","messagePattern":"(.+?) has invalid authority\\.","errorType":"exception","errorClass":"InvalidUriAuthorityException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java","lineNumber":360,"sourceCode":"    } finally {\n      IOUtils.cleanupWithLogger(LOG, getClientHandler());\n    }\n  }\n\n  byte[] encodeAttribute(String value) throws UnsupportedEncodingException {\n    // DFS Client works with ISO_8859_1 encoding, Blob Works with UTF-8.\n    return getClient().encodeAttribute(value);\n  }\n\n  String decodeAttribute(byte[] value) throws UnsupportedEncodingException {\n    // DFS Client works with ISO_8859_1 encoding, Blob Works with UTF-8.\n    return getClient().decodeAttribute(value);\n  }\n\n  private String[] authorityParts(URI uri) throws InvalidUriAuthorityException, InvalidUriException {\n    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;","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java#L342-L378","documentation":"Thrown by AzureBlobFileSystemStore.authorityParts when the URI's raw authority is null — the store cannot extract filesystem (container) and account names, so initialization aborts with InvalidUriAuthorityException ('<uri> has invalid authority.'). This is the store-level counterpart of the client-side authority check: by the time the store sees the URI, an authority must already be present.","triggerScenarios":"Initializing AzureBlobFileSystemStore with a URI like abfs:///path whose authority is null and from which no default-URI authority was reconstructed.","commonSituations":"Missing or empty fs.defaultFS; passing a bare Path('/x') to FileSystem.get for the abfs scheme without any authority source; config systems stripping the authority portion of URIs.","solutions":["Always address ABFS paths as abfs://<container>@<account>.dfs.core.windows.net/... .","Set fs.defaultFS to a fully-qualified abfs URI so relative paths can be qualified.","Validate uri.getRawAuthority() != null before constructing/opening the filesystem."],"exampleFix":"// before\nFileSystem fs = FileSystem.get(new URI(\"abfs:///\"), conf);\n\n// after\nFileSystem fs = FileSystem.get(new URI(\"abfs://data@myaccount.dfs.core.windows.net/\"), conf);","handlingStrategy":"validation","validationCode":"URI u = new URI(fsUrl);\nif (u.getRawAuthority() == null) {\n  throw new IllegalArgumentException(\"ABFS URI requires container@account authority: \" + fsUrl);\n}\nFileSystem fs = FileSystem.get(u, conf);","typeGuard":"static boolean hasAuthority(URI u) {\n  return u.getRawAuthority() != null;\n}","tryCatchPattern":"try {\n  FileSystem.get(uri, conf);\n} catch (InvalidUriAuthorityException e) {\n  throw new ConfigurationException(\"URI missing authority: \" + uri, e);\n}","preventionTips":["Always use fully-qualified abfs:// URIs.","Set fs.defaultFS so relative qualification never reaches the store authority-less.","Validate URI shape where URIs enter the system (config loaders, CLI parsers)."],"tags":["azure-abfs","uri","authority","initialization","configuration"],"backgroundTag":"malformed-uri-authority","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}