huggingface / huggingface/smolagents
Show exception stack trace
- Dominant language
- Python
- Stars
- 29.4k
- Forks
- 3k
- Avg merge
- 17m
- Merged PRs (30d)
- 2
Description
When an exception is thrown, usually only the exception message is shown, without any stack trace.
An exceptions might then be logged like:
> Error in tool call execution: 'NoneType' object has no attribute 'inputs'
Or:
> Error in tool call execution: 'str' object has no attribute 'is_initialized'
Without a stacktrace that is hard to track down.
It seems one workaround is to add a callback to `step_callbacks` that would log the stacktrace of the error.
Although that wouldn't show in the telemetry.
Related it also seems to be preferred to use explicit exception chaining when translating exceptions.
e.g. by adding `from e` in the following example:
```python
except Exception as e:
...
raise AgentExecutionError(...) from e
```
Contributor guide
Research direction
Start at tool call execution error reporting and inspect how step_callbacks and telemetry handle exceptions. Compare the current output with the examples and determine where exception chaining is applied; done means reported errors include a usable stack trace and translated exceptions preserve their cause.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100