BerriAI/litellm · error · ValueError

file_id is required in file_content_request

Error message

file_id is required in file_content_request

What it means

Required-field guard in Bedrock file content download: file_content_request carries no file_id (neither an encoded LiteLLM id nor an S3 URI), so there is nothing to resolve the download location from.

Solutions

  1. Pass file_id in the file content request.
  2. Use the id returned when the file was uploaded.
  3. Check the request body includes file_id.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/bedrock/files/handler.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/c69cf5078d45bd16. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/bedrock/files/handler.py:93

    ) -> HttpxBinaryResponseContent:
        """
        Download file content from S3 bucket for Bedrock files.

        Args:
            file_content_request: Contains file_id (encoded or S3 URI)
            optional_params: Optional parameters containing AWS credentials
            timeout: Request timeout
            max_retries: Max retry attempts

        Returns:
            HttpxBinaryResponseContent: Binary content wrapped in compatible response format
        """
        import boto3
        from botocore.credentials import Credentials

        file_id: Final = file_content_request.get("file_id")
        if not file_id:
            raise ValueError("file_id is required in file_content_request")

        # Extract S3 URI from file ID
        s3_uri: Final = self._extract_s3_uri_from_file_id(file_id)
        configured_bucket_name: Final = self._get_configured_s3_bucket_name(optional_params)
        bucket_name, object_key = self._parse_s3_uri(
            s3_uri=s3_uri,
            configured_bucket_name=configured_bucket_name,
            allow_legacy_cloud_file_ids=should_allow_legacy_cloud_file_ids(optional_params),
        )

        # Get AWS credentials
        aws_region_name: Final = self._get_aws_region_name(optional_params=optional_params, model="")
        credentials: Final[Credentials] = self.get_credentials(
            aws_access_key_id=optional_params.get("aws_access_key_id"),
            aws_secret_access_key=optional_params.get("aws_secret_access_key"),
            aws_session_token=optional_params.get("aws_session_token"),
            aws_region_name=aws_region_name,
            aws_session_name=optional_params.get("aws_session_name"),

View on GitHub (pinned to 77b7c6c40c)