{"record":{"id":"4e1febeb7ac7a70a","repo":"apache/hadoop","slug":"invalid-uri-s","errorCode":null,"errorMessage":"Invalid URI %s","messagePattern":"Invalid URI (.+?)","errorType":"exception","errorClass":"InvalidUriException","httpStatus":null,"severity":"critical","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java","lineNumber":1837,"sourceCode":"   * @param isSecure       Tells if https is being used or http.\n   * @throws IOException\n   */\n  private void initializeClient(URI uri, String fileSystemName,\n      String accountName, boolean isSecure)\n      throws IOException {\n    if (this.getClient() != null) {\n      return;\n    }\n\n    final URIBuilder uriBuilder = getURIBuilder(accountName, isSecure);\n\n    final String url = uriBuilder.toString() + AbfsHttpConstants.FORWARD_SLASH + fileSystemName;\n\n    URL baseUrl;\n    try {\n      baseUrl = new URL(url);\n    } catch (MalformedURLException e) {\n      throw new InvalidUriException(uri.toString());\n    }\n\n    SharedKeyCredentials creds = null;\n    AccessTokenProvider tokenProvider = null;\n    SASTokenProvider sasTokenProvider = null;\n\n    if (authType == AuthType.OAuth) {\n      AzureADAuthenticator.init(abfsConfiguration);\n    }\n\n    if (authType == AuthType.SharedKey) {\n      LOG.trace(\"Fetching SharedKey credentials\");\n      int dotIndex = accountName.indexOf(AbfsHttpConstants.DOT);\n      if (dotIndex <= 0) {\n        throw new InvalidUriException(\n                uri.toString() + \" - account name is not fully qualified.\");\n      }\n      creds = new SharedKeyCredentials(accountName.substring(0, dotIndex),","sourceCodeStart":1819,"sourceCodeEnd":1855,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java#L1819-L1855","documentation":"During client initialization the store builds the base service URL from scheme + authority + filesystem name and wraps it in java.net.URL. If the constructed string is not a valid absolute URL (bad scheme, illegal characters in account or container name, malformed endpoint), MalformedURLException is caught and rethrown as InvalidUriException carrying the filesystem URI. Initialization fails before any network traffic, so the mount is unusable.","triggerScenarios":"Malformed fs.defaultFS authority: container names with uppercase, underscores, or other illegal URL characters; empty account segment (abfs://@host); fs.azure.abfs.endpoint values that corrupt the host; filesystem names that are not DNS-safe.","commonSituations":"Typos in fs.defaultFS; container names violating Azure naming rules (3-63 chars, lowercase alphanumerics and hyphens); spaces or unicode pasted into config; endpoint config producing an invalid host/port pair.","solutions":["Correct fs.defaultFS to abfs://<container>@<account>.dfs.core.windows.net with a DNS-safe container name (lowercase, 3-63 chars, alphanumeric + hyphen).","Check fs.azure.abfs.endpoint is a bare IP:PORT (no scheme) and the port is numeric.","In a test, print new Path(fs.getUri()).toUri() or the raw config to see exactly what the builder received.","Strip whitespace/unicode from config values; XML editors sometimes inject non-breaking spaces."],"exampleFix":"<!-- before -->\n<property><name>fs.defaultFS</name><value>abfs://My_Container@acct.dfs.core.windows.net</value></property>\n\n<!-- after -->\n<property><name>fs.defaultFS</name><value>abfs://my-container@acct.dfs.core.windows.net</value></property>","handlingStrategy":"validation","validationCode":"URI u = new URI(fsDefaultFS);\nif (u.getAuthority() == null || u.getAuthority().split(\"@\").length != 2) {\n  throw new IllegalArgumentException(\"fs.defaultFS must be abfs://container@account.dns: \" + fsDefaultFS);\n}\nnew URL(\"https\", host, port, \"/container\"); // dry-run URL validity","typeGuard":null,"tryCatchPattern":"try { fs = FileSystem.get(conf); } catch (InvalidUriException e) { /* inspect fs.defaultFS authority and fs.azure.abfs.endpoint for illegal characters */ throw e; }","preventionTips":["Validate container/account names against Azure DNS rules (lowercase, 3-63, alnum+hyphen).","Keep fs.azure.abfs.endpoint scheme-free.","Add a mount smoke test (fs.getFileStatus on root) to deployment pipelines."],"tags":["azure","abfs","uri","configuration","client-init"],"backgroundTag":"malformed-url","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}