BerriAI/litellm · error · ValueError

Cloud storage bucket name must not include a URI scheme or…

Error message

Cloud storage bucket name must not include a URI scheme or query

What it means

Validation in split_configured_cloud_bucket_name: the configured bucket name contains '://', '?', or '#', i.e. it looks like a URI with a scheme or query string rather than a bare bucket (optionally with a /prefix).

Solutions

  1. Pass only the bucket name, without 'scheme://' prefixes or '?query' parts.
  2. Strip any URI formatting from the configured bucket name.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/litellm_core_utils/cloud_storage_security.py:93 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/52094819c0c0dc1c. Report an issue: GitHub.

Appendix: source

Thrown at litellm/litellm_core_utils/cloud_storage_security.py:93

        raise ValueError("Cloud storage object name is required")
    if object_name.startswith("/"):
        raise ValueError("Cloud storage object name must be relative")
    if any(ord(char) < 32 or ord(char) == 127 for char in object_name):
        raise ValueError("Cloud storage object name contains control characters")
    segments: Final = object_name.split("/")
    if any(segment in {".", ".."} for segment in segments):
        raise ValueError("Cloud storage object name contains an invalid path segment")
    if "" in segments[:-1]:
        raise ValueError("Cloud storage object name contains an invalid path segment")


def split_configured_cloud_bucket_name(bucket_name: str) -> tuple[str, str]:
    if not isinstance(bucket_name, str) or not bucket_name.strip():
        raise ValueError("Cloud storage bucket name is required")

    bucket_name = bucket_name.strip()
    if "://" in bucket_name or "?" in bucket_name or "#" in bucket_name:
        raise ValueError("Cloud storage bucket name must not include a URI scheme or query")
    if any(ord(char) < 32 or ord(char) == 127 for char in bucket_name):
        raise ValueError("Cloud storage bucket name contains control characters")

    bucket, _, prefix = bucket_name.partition("/")
    if not bucket:
        raise ValueError("Cloud storage bucket name is required")
    if "\\" in bucket:
        raise ValueError("Cloud storage bucket name contains an invalid separator")

    prefix = prefix.strip("/")
    if prefix:
        _validate_cloud_object_path(prefix)

    return bucket, prefix


def encode_gcs_object_name_for_url(object_name: str) -> str:
    return quote(unquote(object_name), safe="")

View on GitHub (pinned to 77b7c6c40c)