{"record":{"id":"5bdb629bb04c0e7e","repo":"apache/beam","slug":"path-r-must-be-azure-blob-storage-path","errorCode":null,"errorMessage":"Path %r must be Azure Blob Storage path.","messagePattern":"Path %r must be Azure Blob Storage path\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/azure/blobstoragefilesystem.py","lineNumber":85,"sourceCode":"    return path\n\n  def split(self, path):\n    \"\"\"Splits the given path into two parts.\n\n    Splits the path into a pair (head, tail) such that tail contains the last\n    component of the path and head contains everything up to that.\n    For file-systems other than the local file-system, head should include the\n    prefix.\n\n    Args:\n      path: path as a string\n\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","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/azure/blobstoragefilesystem.py#L67-L103","documentation":"BlobStorageFileSystem.split divides an 'az://' path into (directory, file) components but first requires the path to carry the Azure 'az://' prefix; otherwise ValueError. It keeps filesystem-specific path parsing from silently operating on foreign paths.","triggerScenarios":"Calling BlobStorageFileSystem.split('wasb://container/blob'), split('/mnt/data/file'), or split on a bare container name.","commonSituations":"Mixing wasb/wasbs legacy scheme paths with the az:// filesystem; handling user-supplied paths without normalization; string manipulation that stripped the scheme earlier in a pipeline.","solutions":["Ensure the path starts with 'az://' before calling split.","Map wasb(s):// and https:// blob URLs to az:// form first.","Guard with a startswith check and raise a clear error for callers."],"exampleFix":"// before\ndir, name = BlobStorageFileSystem.split('wasbs://c/blob')  # ValueError\n// after\npath = path.replace('wasbs://', 'az://', 1)\ndir, name = BlobStorageFileSystem.split(path)","handlingStrategy":"validation","validationCode":"if not path.startswith('az://'):\n    raise ValueError(f\"expected az:// path, got {path!r}\")","typeGuard":"def is_azure_path(p):\n    return isinstance(p, str) and p.startswith('az://')","tryCatchPattern":"try:\n    parent, name = BlobStorageFileSystem.split(path)\nexcept ValueError:\n    path = 'az://' + path.lstrip('/')\n    parent, name = BlobStorageFileSystem.split(path)","preventionTips":["Validate the az:// scheme at ingestion boundaries.","Convert legacy wasb/wasbs schemes before splitting.","Guard against upstream code stripping the scheme."],"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"}