{"record":{"id":"d4d26be2f4bb4505","repo":"apache/hadoop","slug":"invalid-container-name-must-not-contain-co","errorCode":null,"errorMessage":"Invalid container name (must not contain '/'): {container}","messagePattern":"Invalid container name \\(must not contain '/'\\): (.+?)","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":2449,"sourceCode":"  /**\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,\n        requestHeaders);\n    op.execute(tracingContext);\n    return op;\n  }\n}","sourceCodeStart":2431,"sourceCodeEnd":2467,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java#L2431-L2467","documentation":"A client-side precondition in AbfsBlobClient.deleteContainer: the container argument contains '/', i.e. a path was passed where only a single container name segment is valid. Container names are flat account-level identifiers and cannot contain slashes; the call is rejected before any request is sent.","triggerScenarios":"Passing a fully-qualified path (e.g. 'mycontainer/dir/file' or '/mycontainer') instead of just the container segment to deleteContainer.","commonSituations":"Callers deriving the argument from a Path or URL and forgetting to strip to the authority's container part; helper refactors that changed what the string parameter holds.","solutions":["Strip to the first path segment / URI authority before calling: container names must be a single slash-free segment.","Derive the container from the filesystem URI authority (text before '@') rather than from paths.","Add a unit assertion for the container-name shape at the call site."],"exampleFix":"// before\nblobClient.deleteContainer(\"mycontainer/logs/2024\", tracingContext);\n// after\nString container = uri.getAuthority().split(\"@\")[0]; // \"mycontainer\"\nblobClient.deleteContainer(container, tracingContext);","handlingStrategy":"validation","validationCode":"String container = raw.split(\"/\")[0];\nif (container.contains(\"/\") || container.isEmpty()) {\n  throw new IllegalArgumentException(\"Not a container segment: \" + raw);\n}","typeGuard":null,"tryCatchPattern":"catch (AbfsDriverException ex) {\n  if (ex.getMessage().contains(\"must not contain '/'\")) {\n    // a path was passed: strip to the first segment and retry\n  } else throw ex;\n}","preventionTips":["Treat container as a single path segment; validate with a regex like ^[a-z0-9][a-z0-9-]{2,62}$ before calling.","Keep admin helpers that take container names separate from ones that take file paths."],"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-23T01:17:44.959Z"}