apache/hadoop · error · AbfsDriverException

Container name must not be null or empty

Error message

Container name must not be null or empty

What it means

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).

Source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java:2444

      LOG.error("Unable to get stream for list containers response", ex);
      throw new AbfsDriverException(ERR_BLOB_LIST_PARSING, ex);
    }
  }

  /**
   * Deletes a container from the storage account using the Blob service endpoint.
   *
   * @param container name of the container to delete (must be a single path segment)
   * @param tracingContext tracing context for the REST call
   * @return REST operation representing the delete request
   * @throws AzureBlobFileSystemException if the delete operation fails
   */
  public AbfsRestOperation deleteContainer(
      final String container,
      final TracingContext tracingContext)
      throws AzureBlobFileSystemException, MalformedURLException {
    if (StringUtils.isEmpty(container)) {
      throw new AbfsDriverException(
          "Container name must not be null or empty",
          new IllegalArgumentException("container"));
    }
    if (container.contains(FORWARD_SLASH)) {
      throw new AbfsDriverException(
          "Invalid container name (must not contain '/'): " + container,
          new IllegalArgumentException(container));
    }
    final List<AbfsHttpHeader> requestHeaders = createDefaultHeaders();
    final AbfsUriQueryBuilder queryBuilder = createDefaultUriQueryBuilder();
    queryBuilder.addQuery(QUERY_PARAM_RESTYPE, CONTAINER);
    appendSASTokenToQuery(container, SASTokenProvider.DELETE_CONTAINERS_OPERATION, queryBuilder);
    final URL accountUrl = new URL(getBaseUrl().getProtocol(), getBaseUrl().getHost(), ROOT_PATH);
    final URL url = createRequestUrl(accountUrl, container, queryBuilder.toString());
    final AbfsRestOperation op = getAbfsRestOperation(
        AbfsRestOperationType.DeleteContainer,
        HTTP_METHOD_DELETE,
        url,

View on GitHub (pinned to 2add963021)

Solutions

  1. Pass the container name explicitly, taken from the filesystem URI authority (e.g. 'data' from abfs://data@account.dfs.core.windows.net).
  2. Log and validate the derived container name at the call site before invoking deleteContainer.
  3. Fix the upstream URI/config parsing that produced an empty container.

Example fix

// before
String container = uriToContainer(userProvidedUri); // may return null
blobClient.deleteContainer(container, tracingContext);
// after
String container = new URI(userProvidedUri).getAuthority(); // "data@account..."
container = container != null ? container.split("@")[0] : null;
if (container == null || container.isEmpty()) {
  throw new IllegalArgumentException("URI lacks container: " + userProvidedUri);
}
blobClient.deleteContainer(container, tracingContext);
Defensive patterns

Strategy: validation

Validate before calling

if (StringUtils.isEmpty(container)) {
  throw new IllegalArgumentException("container name required");
}

Try / catch

catch (AbfsDriverException ex) {
  if (ex.getMessage().contains("Container name must not be null or empty")) {
    // fix upstream URI parsing that produced the empty container
  } else throw ex;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/5ffecba8771a72d9. Report an issue: GitHub.