{"record":{"id":"19e3d83e1de3371d","repo":"apache/beam","slug":"basepath-r-must-be-an-azure-blob-storage-path","errorCode":null,"errorMessage":"Basepath %r must be an Azure Blob Storage path.","messagePattern":"Basepath %r must be an Azure Blob Storage path\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/azure/blobstoragefilesystem.py","lineNumber":61,"sourceCode":"    self._pipeline_options = pipeline_options\n\n  @classmethod\n  def scheme(cls):\n    \"\"\"URI scheme for the FileSystem\n    \"\"\"\n    return 'azfs'\n\n  def join(self, basepath, *paths):\n    \"\"\"Join two or more pathname components for the filesystem\n\n    Args:\n      basepath: string path of the first component of the path\n      paths: path components to be added\n\n    Returns: full path after combining all the passed components\n    \"\"\"\n    if not basepath.startswith(BlobStorageFileSystem.AZURE_FILE_SYSTEM_PREFIX):\n      raise ValueError(\n          'Basepath %r must be an Azure Blob Storage path.' % basepath)\n\n    path = basepath\n    for p in paths:\n      path = path.rstrip('/') + '/' + p.lstrip('/')\n    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","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/azure/blobstoragefilesystem.py#L43-L79","documentation":"BlobStorageFileSystem.join validates that the base path starts with the Azure prefix 'az://' before combining path components; otherwise it raises ValueError. This guards against mixing local or other-cloud paths into Azure Blob Storage path math.","triggerScenarios":"Calling BlobStorageFileSystem.join('wasbs://.../path', 'file') or join('/local/path', 'f') — any basepath not beginning with 'az://'.","commonSituations":"Using account-URL style paths (https://account.blob.core.windows.net/container) or the older wasb:/wasbs: schemes instead of 'az://'; passing a local temp directory as basepath; Beam MatchAll results from another filesystem.","solutions":["Prefix the base path with 'az://', e.g. 'az://container/blob'.","Convert https://account.blob.core.windows.net/container/key style URLs to 'az://container/key'.","Normalize/validate incoming paths with a helper that asserts the 'az://' prefix before joining."],"exampleFix":"// before\np = BlobStorageFileSystem.join('https://acct.blob.core.windows.net/c', 'f')  # ValueError\n// after\np = BlobStorageFileSystem.join('az://c', 'f')","handlingStrategy":"validation","validationCode":"if not basepath.startswith('az://'):\n    basepath = 'az://' + basepath.lstrip('/')","typeGuard":"def is_azure_path(p):\n    return isinstance(p, str) and p.startswith('az://')","tryCatchPattern":"try:\n    p = BlobStorageFileSystem.join(base, name)\nexcept ValueError as e:\n    logging.error(\"bad azure basepath: %s\", e)\n    p = BlobStorageFileSystem.join('az://' + base, name)","preventionTips":["Normalize wasb(s):// and https://account.blob... URLs to az:// early.","Keep a single path-normalization helper for all Azure paths.","Never pass local paths into cloud filesystem helpers."],"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"}