{"record":{"id":"5ffecba8771a72d9","repo":"apache/hadoop","slug":"container-name-must-not-be-null-or-empty","errorCode":null,"errorMessage":"Container name must not be null or empty","messagePattern":"Container name must not be null or empty","errorType":"validation","errorClass":"AbfsDriverException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java","lineNumber":2444,"sourceCode":"      LOG.error(\"Unable to get stream for list containers response\", ex);\n      throw new AbfsDriverException(ERR_BLOB_LIST_PARSING, ex);\n    }\n  }\n\n  /**\n   * Deletes a container from the storage account using the Blob service endpoint.\n   *\n   * @param container name of the container to delete (must be a single path segment)\n   * @param tracingContext tracing context for the REST call\n   * @return REST operation representing the delete request\n   * @throws AzureBlobFileSystemException if the delete operation fails\n   */\n  public AbfsRestOperation deleteContainer(\n      final String container,\n      final TracingContext tracingContext)\n      throws AzureBlobFileSystemException, MalformedURLException {\n    if (StringUtils.isEmpty(container)) {\n      throw new AbfsDriverException(\n          \"Container name must not be null or empty\",\n          new IllegalArgumentException(\"container\"));\n    }\n    if (container.contains(FORWARD_SLASH)) {\n      throw new AbfsDriverException(\n          \"Invalid container name (must not contain '/'): \" + container,\n          new IllegalArgumentException(container));\n    }\n    final List<AbfsHttpHeader> requestHeaders = createDefaultHeaders();\n    final AbfsUriQueryBuilder queryBuilder = createDefaultUriQueryBuilder();\n    queryBuilder.addQuery(QUERY_PARAM_RESTYPE, CONTAINER);\n    appendSASTokenToQuery(container, SASTokenProvider.DELETE_CONTAINERS_OPERATION, queryBuilder);\n    final URL accountUrl = new URL(getBaseUrl().getProtocol(), getBaseUrl().getHost(), ROOT_PATH);\n    final URL url = createRequestUrl(accountUrl, container, queryBuilder.toString());\n    final AbfsRestOperation op = getAbfsRestOperation(\n        AbfsRestOperationType.DeleteContainer,\n        HTTP_METHOD_DELETE,\n        url,","sourceCodeStart":2426,"sourceCodeEnd":2462,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java#L2426-L2462","documentation":"A client-side precondition in AbfsBlobClient.deleteContainer: the container argument is null or empty. No service call is made; this is a caller programming error indicating the container name was never resolved (e.g., parsing a URI that had no authority).","triggerScenarios":"Calling deleteContainer (or a wrapper like filesystem/account cleanup code) with a null/blank container string — typically derived from a misparsed filesystem URI such as abfs:///path without a container authority.","commonSituations":"Scripts building URIs dynamically where the container component is missing; configuration strings with stray whitespace or empty defaults; refactors that pass the path instead of the container.","solutions":["Pass the container name explicitly, taken from the filesystem URI authority (e.g. 'data' from abfs://data@account.dfs.core.windows.net).","Log and validate the derived container name at the call site before invoking deleteContainer.","Fix the upstream URI/config parsing that produced an empty container."],"exampleFix":"// before\nString container = uriToContainer(userProvidedUri); // may return null\nblobClient.deleteContainer(container, tracingContext);\n// after\nString container = new URI(userProvidedUri).getAuthority(); // \"data@account...\"\ncontainer = container != null ? container.split(\"@\")[0] : null;\nif (container == null || container.isEmpty()) {\n  throw new IllegalArgumentException(\"URI lacks container: \" + userProvidedUri);\n}\nblobClient.deleteContainer(container, tracingContext);","handlingStrategy":"validation","validationCode":"if (StringUtils.isEmpty(container)) {\n  throw new IllegalArgumentException(\"container name required\");\n}","typeGuard":null,"tryCatchPattern":"catch (AbfsDriverException ex) {\n  if (ex.getMessage().contains(\"Container name must not be null or empty\")) {\n    // fix upstream URI parsing that produced the empty container\n  } else throw ex;\n}","preventionTips":["Derive container names from the URI authority (before '@'), never from paths.","Assert non-empty container before any account-level admin call.","Unit-test URI parsing helpers for inputs without authority."],"tags":["azure","abfs","container","validation","argument-error"],"backgroundTag":"invalid-container-name","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}