{"record":{"id":"6934521e9a497448","repo":"apache/beam","slug":"invalid-path-s-blobstoragefilesystem","errorCode":null,"errorMessage":"Invalid path: %s","messagePattern":"Invalid path: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/azure/blobstoragefilesystem.py","lineNumber":97,"sourceCode":"\n    Returns:\n      a pair of path components as strings.\n    \"\"\"\n    path = path.strip()\n    if not path.startswith(BlobStorageFileSystem.AZURE_FILE_SYSTEM_PREFIX):\n      raise ValueError('Path %r must be Azure Blob Storage path.' % path)\n\n    prefix_len = len(BlobStorageFileSystem.AZURE_FILE_SYSTEM_PREFIX)\n    last_sep = path[prefix_len:].rfind('/')\n    if last_sep >= 0:\n      last_sep += prefix_len\n\n    if last_sep > 0:\n      return (path[:last_sep], path[last_sep + 1:])\n    elif last_sep < 0:\n      return (path, '')\n    else:\n      raise ValueError('Invalid path: %s' % path)\n\n  def mkdirs(self, path):\n    \"\"\"Recursively create directories for the provided path.\n\n    Args:\n      path: string path of the directory structure that should be created\n\n    Raises:\n      IOError: if leaf directory already exists.\n    \"\"\"\n    pass\n\n  def has_dirs(self):\n    \"\"\"Whether this FileSystem supports directories.\"\"\"\n    return False\n\n  def _list(self, dir_or_prefix):\n    \"\"\"List files in a location.","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/azure/blobstoragefilesystem.py#L79-L115","documentation":"After prefix validation, BlobStorageFileSystem.split returns (parent, name) based on the last '/'. If the only '/' is exactly at the end of the 'az://' prefix (last_sep == 0), there is no parent or name to return, so it raises ValueError('Invalid path').","triggerScenarios":"Calling split('az://') or split('az:///') — a path with a container-less, slash-only root and no file component.","commonSituations":"Parsing an empty or root-level path; a caller stripping the container from a path before splitting; off-by-one when slicing paths in upstream code.","solutions":["Pass a full path of the form 'az://container/blob' including a non-root component.","Check for the degenerate root path before calling split and handle it separately.","Ensure upstream path manipulation does not strip the container name."],"exampleFix":"// before\ndir, name = BlobStorageFileSystem.split('az://')  # ValueError\n// after\nif path.rstrip('/') == 'az://':\n    return ('', '')\ndir, name = BlobStorageFileSystem.split(path)","handlingStrategy":"validation","validationCode":"if path in ('az://', 'az:///', ''):\n    raise ValueError('root az:// path cannot be split into parent/name')","typeGuard":"def is_splittable_azure_path(p):\n    return isinstance(p, str) and p.startswith('az://') and '/' in p[5:]","tryCatchPattern":"try:\n    parent, name = BlobStorageFileSystem.split(path)\nexcept ValueError:\n    parent, name = '', ''  # degenerate root path","preventionTips":["Always include a container plus blob component in paths you split.","Handle the root path as a special case before calling split.","Check upstream slicing hasn't reduced the path to the bare prefix."],"tags":["python","azure","blob-storage","path","invalid-argument"],"backgroundTag":"invalid-url-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}