Skip to content

fix: replace bare raise with ToolUsageError in _original_tool_calling (#6430)#6589

Open
fazalpsinfo-cmyk wants to merge 1 commit into
crewAIInc:mainfrom
fazalpsinfo-cmyk:fix/bare-raise-6430
Open

fix: replace bare raise with ToolUsageError in _original_tool_calling (#6430)#6589
fazalpsinfo-cmyk wants to merge 1 commit into
crewAIInc:mainfrom
fazalpsinfo-cmyk:fix/bare-raise-6430

Conversation

@fazalpsinfo-cmyk

Copy link
Copy Markdown

Description

A bare raise in _original_tool_calling() at line 853 is outside any exception handler. When arguments is not a dict, this causes RuntimeError: No active exception to re-raise instead of a meaningful error.

Fix

Replaced the bare raise with raise ToolUsageError(...), matching the error path that already exists in the non-raise branch.

Closes #6430


Support my work: https://buymeacoffee.com/muhamedfazalps

A bare `raise` at line 853 is outside any exception handler, causing
RuntimeError when arguments is not a dict. Replaced with ToolUsageError.

Closes crewAIInc#6430
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1168d453-b029-4125-851e-3cc3f046fb52

📥 Commits

Reviewing files that changed from the base of the PR and between 69c0308 and 0bf2a8c.

📒 Files selected for processing (1)
  • lib/crewai/src/crewai/tools/tool_usage.py

📝 Walkthrough

Walkthrough

ToolUsage._original_tool_calling now raises a localized ToolUsageError when validated tool input is not a dictionary and raise_error=True, replacing the previous bare re-raise.

Changes

Tool input error handling

Layer / File(s) Summary
Raise ToolUsageError for invalid arguments
lib/crewai/src/crewai/tools/tool_usage.py
Invalid non-dictionary tool arguments now raise ToolUsageError with the localized tool_arguments_error message.

Suggested reviewers: greysonlalonde

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the change to replace a bare raise with ToolUsageError in _original_tool_calling.
Description check ✅ Passed The description is directly about the same bug fix in _original_tool_calling and matches the reported behavior.
Linked Issues check ✅ Passed The change addresses #6430 by removing the bare raise and raising ToolUsageError with the existing tool-arguments message.
Out of Scope Changes check ✅ Passed The PR appears scoped to the single targeted error-path fix with no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Bare raise in ToolUsage._original_tool_calling causes RuntimeError instead of ToolUsageError

1 participant