crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

get_uploader raises RuntimeError instead of returning None for unsupported/unconfigured providers

Open SWAPI03 opened this issue 2 months ago • 2 comments

Description

crewai_files.uploaders.get_uploader is documented to return None when a provider is not supported ("Returns: FileUploader instance for the provider, or None if not supported"), and every caller branches on if uploader is None. But two fallthrough paths run a bare raise with no active exception, so instead of returning None they raise RuntimeError: No active exception to reraise:

  • an unknown/unsupported provider (the final line of the function)
  • a Bedrock provider when CREWAI_BEDROCK_S3_BUCKET is unset and no bucket_name is passed

The except ImportError: ... raise blocks are correct (they re-raise the ImportError when a provider SDK is not installed); only the two non-except bare raises are affected.

Steps to Reproduce

from crewai_files.uploaders import get_uploader

get_uploader("does-not-exist")   # RuntimeError: No active exception to reraise
get_uploader("bedrock")          # RuntimeError (when CREWAI_BEDROCK_S3_BUCKET is unset)

Expected behavior

Both return None, matching the docstring and every caller's if uploader is None check

Screenshots/Code snippets

lib/crewai-files/src/crewai_files/uploaders/factory.py: the bare raise in the "Bedrock S3 uploader not configured" branch, and the bare raise at the final "No file uploader available for provider" line

Operating System

Not OS-specific (reproduces on Linux, macOS, Windows)

Python Version

3.12

Additional context

I have a fix ready and will open a PR. Reported with AI assistance, hence the llm-generated label per CONTRIBUTING

SWAPI03 avatar Sep 05 '26 08:09 SWAPI03

Note for maintainers: this issue and the incoming PR were created with AI assistance. Per CONTRIBUTING they need the llm-generated label, but I cannot apply it as an external contributor (no triage permission). Could a maintainer please add it. Thanks

SWAPI03 avatar Sep 05 '26 08:09 SWAPI03

OSS-147

linear[bot] avatar Sep 07 '26 07:09 linear[bot]