Description
Two bare raise statements in get_uploader() (lib/crewai-files/src/crewai_files/uploaders/factory.py)
are outside any exception handler:
- Line 199 — hit when Bedrock is requested without CREWAI_BEDROCK_S3_BUCKET configured
- Line 216 — hit when an unsupported provider string is passed
A bare raise re-raises the exception currently being handled, but neither path is inside
an except block — so instead of a meaningful error, Python raises:
RuntimeError: No active exception to re-raise
Steps to Reproduce
from crewai_files.uploaders.factory import get_uploader
get_uploader("bedrock") # without CREWAI_BEDROCK_S3_BUCKET set
RuntimeError: No active exception to re-raise
get_uploader("not-a-real-provider")
RuntimeError: No active exception to re-raise
Expected behavior
A meaningful exception, not RuntimeError. The package already has PermanentUploadError in
crewai_files/processing/exceptions.py for exactly this kind of non-retryable config/input error.
Screenshots/Code snippets
if (
not os.environ.get("CREWAI_BEDROCK_S3_BUCKET")
and "bucket_name" not in kwargs
):
logger.debug(...)
raise # <- no active exception here
...
logger.debug(f"No file uploader available for provider: {provider}")
raise # <- same issue
Operating System
Windows 11
Python Version
3.12
crewAI Version
1.15.2a2
crewAI Tools Version
N/A — bug is in the crewai-files package, not crewai-tools
Virtual Environment
Venv
Evidence
$ uv run python repro.py
Bug 1 -> RuntimeError: No active exception to reraise
Bug 2 -> RuntimeError: No active exception to reraise
$ ruff check lib/crewai-files/ --select PLE0704
PLE0704 Bare raise statement is not inside an exception handler
--> lib/crewai-files/src/crewai_files/uploaders/factory.py:199
PLE0704 Bare raise statement is not inside an exception handler
--> lib/crewai-files/src/crewai_files/uploaders/factory.py:216
Possible Solution
Replace both bare raise statements with raise PermanentUploadError(message),
using the same message already being logged via logger.debug() on the line above.
I have a fix with regression tests ready and will open a PR referencing this issue.
Additional context
I used AI-assisted static analysis (running ruff's PLE0704 rule across the codebase) to
find this — it's the same defect pattern as #6430, just in a different file that hadn't
been checked yet. Per CONTRIBUTING.md, this needs the llm-generated label; I don't have
permission to add it myself, could a maintainer please apply it?
Description
Two bare
raisestatements inget_uploader()(lib/crewai-files/src/crewai_files/uploaders/factory.py)are outside any exception handler:
A bare
raisere-raises the exception currently being handled, but neither path is insidean except block — so instead of a meaningful error, Python raises:
RuntimeError: No active exception to re-raise
Steps to Reproduce
from crewai_files.uploaders.factory import get_uploader
get_uploader("bedrock") # without CREWAI_BEDROCK_S3_BUCKET set
RuntimeError: No active exception to re-raise
get_uploader("not-a-real-provider")
RuntimeError: No active exception to re-raise
Expected behavior
A meaningful exception, not RuntimeError. The package already has PermanentUploadError in
crewai_files/processing/exceptions.py for exactly this kind of non-retryable config/input error.
Screenshots/Code snippets
if (
not os.environ.get("CREWAI_BEDROCK_S3_BUCKET")
and "bucket_name" not in kwargs
):
logger.debug(...)
raise # <- no active exception here
...
logger.debug(f"No file uploader available for provider: {provider}")
raise # <- same issue
Operating System
Windows 11
Python Version
3.12
crewAI Version
1.15.2a2
crewAI Tools Version
N/A — bug is in the crewai-files package, not crewai-tools
Virtual Environment
Venv
Evidence
$ uv run python repro.py
Bug 1 -> RuntimeError: No active exception to reraise
Bug 2 -> RuntimeError: No active exception to reraise
$ ruff check lib/crewai-files/ --select PLE0704
PLE0704 Bare
raisestatement is not inside an exception handler--> lib/crewai-files/src/crewai_files/uploaders/factory.py:199
PLE0704 Bare
raisestatement is not inside an exception handler--> lib/crewai-files/src/crewai_files/uploaders/factory.py:216
Possible Solution
Replace both bare
raisestatements withraise PermanentUploadError(message),using the same message already being logged via logger.debug() on the line above.
I have a fix with regression tests ready and will open a PR referencing this issue.
Additional context
I used AI-assisted static analysis (running ruff's PLE0704 rule across the codebase) to
find this — it's the same defect pattern as #6430, just in a different file that hadn't
been checked yet. Per CONTRIBUTING.md, this needs the llm-generated label; I don't have
permission to add it myself, could a maintainer please apply it?