BerriAI/litellm · error · ValueError

file_id object does not match the configured storage prefix

Error message

file_id object does not match the configured storage prefix

What it means

Validation guard: the object name extracted from the file_id URI does not start with any allowed prefix (the configured bucket prefix plus allowed_object_prefixes), meaning the object lies outside the paths LiteLLM permits to resolve. Fires when a file_id references an object outside managed prefixes.

Solutions

  1. Use a file_id whose object path starts with the configured storage prefix.
  2. Re-upload the file via LiteLLM so it lands under the managed prefix.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/litellm_core_utils/cloud_storage_security.py:164 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/d0619c4a1e065317. Report an issue: GitHub.

Appendix: source

Thrown at litellm/litellm_core_utils/cloud_storage_security.py:164

    if "/" not in full_path:
        raise ValueError("file_id must include a cloud storage object name")

    bucket_name, object_name = full_path.split("/", 1)
    configured_bucket, configured_prefix = split_configured_cloud_bucket_name(configured_bucket_name)
    if bucket_name != configured_bucket:
        raise ValueError("file_id bucket does not match the configured storage bucket")

    _validate_cloud_object_path(object_name)
    allowed_prefixes = tuple(allowed_object_prefixes)
    if configured_prefix:
        allowed_prefixes = tuple(f"{configured_prefix.rstrip('/')}/{prefix}" for prefix in allowed_prefixes)

    if object_name.startswith(allowed_prefixes):
        return bucket_name, object_name

    if allow_legacy_cloud_file_ids:
        if configured_prefix and not object_name.startswith(f"{configured_prefix.rstrip('/')}/"):
            raise ValueError("file_id object does not match the configured storage prefix")
        return bucket_name, object_name

    raise ValueError("file_id must reference a LiteLLM-managed storage object")

View on GitHub (pinned to 77b7c6c40c)