{"record":{"id":"e6491c27d10e8129","repo":"BerriAI/litellm","slug":"file-id-must-be-a-managed-litellm-s3-file-id","errorCode":null,"errorMessage":"file_id must be a managed LiteLLM S3 file id","messagePattern":"file_id must be a managed LiteLLM S3 file id","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/files/transformation.py","lineNumber":181,"sourceCode":"    Resolve a Bedrock file id to its S3 URI.\n\n    Accepts either a base64-encoded LiteLLM unified file id (whose decoded\n    form carries `llm_output_file_id,s3://...`) or a direct `s3://` URI.\n    \"\"\"\n    try:\n        padded: Final = file_id + \"=\" * (-len(file_id) % 4)\n        decoded: Final = base64.urlsafe_b64decode(padded).decode()\n\n        if decoded.startswith(SpecialEnums.LITELM_MANAGED_FILE_ID_PREFIX.value):\n            if \"llm_output_file_id,\" in decoded:\n                return decoded.split(\"llm_output_file_id,\")[1].split(\";\")[0]\n    except Exception:\n        pass\n\n    if file_id.startswith(\"s3://\"):\n        return file_id\n\n    raise ValueError(\"file_id must be a managed LiteLLM S3 file id\")\n\n\n_S3_BUCKET_REQUIRED_ERROR: Final = \"S3 bucket_name is required. Set 's3_bucket_name' in proxy config or AWS_S3_BUCKET_NAME for Bedrock file content retrieval.\"\n\n\ndef _trusted_s3_model_credentials(litellm_params: Mapping[str, object]) -> _TrustedS3ModelCredentials:\n    trusted_model_credentials: Final = litellm_params.get(\"_litellm_internal_model_credentials\")\n    if not isinstance(trusted_model_credentials, MappingProxyType):\n        return _TrustedS3ModelCredentials()\n    snapshot: Final[dict[str, object]] = {}\n    snapshot.update(trusted_model_credentials)  # any-ok: untyped snapshot\n    return _TrustedS3ModelCredentials.model_validate(snapshot)\n\n\ndef get_configured_s3_bucket_name(litellm_params: Mapping[str, object]) -> str:\n    \"\"\"\n    Resolve the server-configured S3 bucket for Bedrock file operations.\n","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/files/transformation.py#L163-L199","documentation":"Identity guard in Bedrock file-id resolution: the value is neither a base64 LiteLLM managed file id (with the llm_output_file_id prefix) nor a direct s3:// URI, so it cannot be resolved to an S3 location and is rejected as unmanaged.","triggerScenarios":"Thrown at litellm/llms/bedrock/files/transformation.py:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a file id returned by the LiteLLM managed S3 files API.","Upload the file via LiteLLM first, then reference its managed id.","Do not pass raw S3 URIs or foreign file ids to this endpoint."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}