bug: tool exceptions are caught and replaced with generic error messages — lose root cause
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 58.8k
- Forks
- 8.5k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 109
Description
Problem
When a tool raises an exception during execution, CrewAI catches it and replaces the full traceback with a generic error string like "Error: tool execution failed". The original exception type, message, and traceback are discarded.
This makes debugging impossible — users can't tell whether the failure was:
- A transient network error (should retry)
- A parameter validation error (should fix input)
- A tool bug (should report upstream)
- A rate limit / auth error (should adjust config)
Steps to Reproduce
- Create a custom tool that raises
ValueError("invalid parameter: count must be positive") - Configure a crew to use this tool
- The agent receives only "Error: tool execution failed" with no indication of what went wrong
Expected Behavior
The full exception should be available to:
- The agent (so it can adapt its strategy — retry, fix input, skip tool)
- The user/logs (for debugging)
- At minimum, a structured error object with
type,message, andtracebackfields
Proposed Fix
# Instead of:
return f"Error: tool execution failed"
# Return:
return json.dumps({
"error": True,
"type": type(e).__name__,
"message": str(e),
"retryable": isinstance(e, (TimeoutError, ConnectionError)),
})
Related
- #5930 (PDF tool errors are swallowed)
- #5990 (Deepseek format errors are opaque)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the tool execution path where exceptions are caught and generic errors are returned; the issue does not name a file or test. Review related issues #5930 and #5990 for existing behavior, then verify that exception type, message, and traceback information reach the agent and user or logs without losing useful error context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100