{"record":{"id":"6650aaabe799fc31","repo":"apache/hadoop","slug":"uri","errorCode":null,"errorMessage":"{uri}","messagePattern":"\\{uri\\}","errorType":"exception","errorClass":"IllegalArgumentException (InvalidUriException)","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java","lineNumber":1607,"sourceCode":"  private URI ensureAuthority(URI uri, final Configuration conf) {\n\n    Preconditions.checkNotNull(uri, \"uri\");\n\n    if (uri.getAuthority() == null) {\n      final URI defaultUri = FileSystem.getDefaultUri(conf);\n\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)) {","sourceCodeStart":1589,"sourceCodeEnd":1625,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java#L1589-L1625","documentation":"Thrown during URI qualification when AzureBlobFileSystem tries to rebuild a URI using the authority of the configured default filesystem URI (which uses an abfs scheme) and java.net.URI rejects the combination with URISyntaxException. The code comments say this should never happen; in practice it means the default URI's authority contains characters illegal in a URI authority component. The result is an IllegalArgumentException wrapping InvalidUriException, whose message is just the offending URI string.","triggerScenarios":"fs.defaultFS (or the fs URI passed to FileSystem.get) uses an abfs/abfss scheme with an authority containing spaces or other characters illegal in a URI authority, and makeQualified/initialize triggers URI reconstruction.","commonSituations":"Hand-edited core-site.xml with malformed fs.defaultFS (trailing spaces, unencoded characters, smart quotes from copy-paste); environment variables injecting unencoded account names; templated config rendering bad values.","solutions":["Fix fs.defaultFS to the canonical form abfs://<container>@<account>.dfs.core.windows.net.","URL-encode any special characters in container or account names.","Validate the default URI with new URI(...) at application startup before any FS call."],"exampleFix":"<!-- before -->\n<property><name>fs.defaultFS</name><value>abfs://my container@acc ount.dfs.core.windows.net</value></property>\n\n<!-- after -->\n<property><name>fs.defaultFS</name><value>abfs://my-container@account.dfs.core.windows.net</value></property>","handlingStrategy":"validation","validationCode":"// at startup, before any FS call\nURI def = new URI(conf.get(\"fs.defaultFS\"));\nURI roundTrip = new URI(def.getScheme(), def.getAuthority(), def.getPath(), null, null);\nif (roundTrip.getAuthority() == null) {\n  throw new IllegalStateException(\"fs.defaultFS authority invalid: \" + def);\n}","typeGuard":null,"tryCatchPattern":"try {\n  fs.makeQualified(path);\n} catch (IllegalArgumentException e) {\n  if (e.getCause() instanceof InvalidUriException) {\n    throw new ConfigurationException(\"fs.defaultFS has an illegal authority\", e);\n  }\n  throw e;\n}","preventionTips":["Use canonical abfs://container@account.dfs.core.windows.net in fs.defaultFS.","Never hand-edit URIs with spaces or unencoded characters; URL-encode components.","Add a startup URI self-test in integration test suites."],"tags":["azure-abfs","uri","configuration","illegal-argument","fs-defaultfs"],"backgroundTag":"malformed-uri-authority","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}