crewAIInc / crewAIInc/crewAI

bug: tool exceptions are caught and replaced with generic error messages — lose root cause

Open
#6,262 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

no-issue-activity
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

  1. Create a custom tool that raises ValueError("invalid parameter: count must be positive")
  2. Configure a crew to use this tool
  3. The agent receives only "Error: tool execution failed" with no indication of what went wrong

Expected Behavior

The full exception should be available to:

  1. The agent (so it can adapt its strategy — retry, fix input, skip tool)
  2. The user/logs (for debugging)
  3. At minimum, a structured error object with type, message, and traceback fields

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.