BerriAI/litellm · error · HTTPException

Raw cloud storage file ids cannot be retrieved directly. Use

Error message

Raw cloud storage file ids cannot be retrieved directly. Use the LiteLLM managed file id returned when the file was created.

What it means

HTTPException raised on file-content retrieval: the supplied file_id is a raw cloud-storage URI (s3://, gs://) rather than a LiteLLM managed/unified id. Raw URIs would bypass the managed-file ownership check, so direct retrieval is blocked — the caller must use the managed id returned at creation.

Source

Thrown at litellm/proxy/openai_files_endpoints/files_endpoints.py:734

                    }
                )

            else:
                response = await managed_files_obj.afile_content(
                    **{
                        "file_id": file_id,
                        "litellm_parent_otel_span": user_api_key_dict.parent_otel_span,
                        "llm_router": llm_router,
                        **data,
                    }
                )
        else:
            # A raw cloud-storage URI (s3://, gs://) supplied here would skip the
            # managed-file owner/team check that only runs for unified ids, letting
            # a caller read another tenant's object by its key. Such objects are only
            # reachable through their managed unified id.
            if is_managed_cloud_storage_uri(file_id):
                raise HTTPException(
                    status_code=400,
                    detail="Raw cloud storage file ids cannot be retrieved directly. Use the LiteLLM managed file id returned when the file was created.",
                )
            # Check for model-based credential routing
            (
                should_route,
                model_used,
                original_file_id,
                credentials,
            ) = handle_model_based_routing(
                file_id=file_id,
                request=request,
                llm_router=llm_router,
                data=data,
                check_file_id_encoding=True,
            )

            if not should_route:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use the LiteLLM managed file id returned at creation time instead of the raw cloud storage id.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/openai_files_endpoints/files_endpoints.py:734 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/0770174e9a54dd5d. Report an issue: GitHub.