{"record":{"id":"1be9d18bd776b0c2","repo":"apache/hadoop","slug":"uri-has-invalid-authority","errorCode":null,"errorMessage":"{uri} has invalid authority.","messagePattern":"(.+?) has invalid authority\\.","errorType":"exception","errorClass":"IllegalArgumentException (InvalidUriAuthorityException)","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java","lineNumber":1613,"sourceCode":"\n      if (defaultUri != null && isAbfsScheme(defaultUri.getScheme())) {\n        try {\n          // Reconstruct the URI with the authority from the default URI.\n          uri = new URI(\n              uri.getScheme(),\n              defaultUri.getAuthority(),\n              uri.getPath(),\n              uri.getQuery(),\n              uri.getFragment());\n        } catch (URISyntaxException e) {\n          // This should never happen.\n          throw new IllegalArgumentException(new InvalidUriException(uri.toString()));\n        }\n      }\n    }\n\n    if (uri.getAuthority() == null) {\n      throw new IllegalArgumentException(new InvalidUriAuthorityException(uri.toString()));\n    }\n\n    return uri;\n  }\n\n  private boolean isAbfsScheme(final String scheme) {\n    if (scheme == null) {\n      return false;\n    }\n\n    if (scheme.equals(FileSystemUriSchemes.ABFS_SCHEME)\n        || scheme.equals(FileSystemUriSchemes.ABFS_SECURE_SCHEME)) {\n      return true;\n    }\n\n    return false;\n  }\n","sourceCodeStart":1595,"sourceCodeEnd":1631,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java#L1595-L1631","documentation":"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.').","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set fs.defaultFS to a fully-qualified abfs://container@account.dfs.core.windows.net value.","Use fully-qualified Path objects (abfs://container@account.dfs.core.windows.net/dir/file) in code.","Verify the scheme of the default URI matches the filesystem being opened."],"exampleFix":"// before\nFileSystem fs = path.getFileSystem(conf); // path = /data/input (relative)\n\n// after\nPath qualified = new Path(\"abfs://data@myaccount.dfs.core.windows.net/data/input\");\nFileSystem fs = qualified.getFileSystem(conf);","handlingStrategy":"validation","validationCode":"URI u = path.toUri();\nif (u.getAuthority() == null) {\n  URI def = new URI(conf.get(\"fs.defaultFS\"));\n  if (!\"abfs\".equals(def.getScheme()) && !\"abfss\".equals(def.getScheme())) {\n    throw new IllegalStateException(\"No abfs authority available for \" + path);\n  }\n}\nFileSystem fs = path.getFileSystem(conf);","typeGuard":"static boolean hasAuthority(URI u) {\n  return u.getRawAuthority() != null;\n}","tryCatchPattern":"try {\n  fs.open(path);\n} catch (IllegalArgumentException e) {\n  if (e.getCause() instanceof InvalidUriAuthorityException) {\n    throw new ConfigurationException(\"Path lacks container@account authority: \" + path, e);\n  }\n  throw e;\n}","preventionTips":["Always construct ABFS paths fully qualified.","Set fs.defaultFS to a fully-qualified abfs URI in every environment.","Check the default FS scheme matches before qualifying relative paths."],"tags":["azure-abfs","uri","authority","configuration","fs-defaultfs"],"backgroundTag":"malformed-uri-authority","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}