mirror of
https://github.com/hwchase17/langchain.git
synced 2025-10-22 09:41:52 +00:00
**Description:** Fixed a bug in `BaseCallbackManager.remove_handler()` that caused a `ValueError` when removing a handler added via the constructor's `handlers` parameter. The issue occurred because handlers passed to the constructor were added only to the `handlers` list and not automatically to `inheritable_handlers` unless explicitly specified. However, `remove_handler()` attempted to remove the handler from both lists unconditionally, triggering a `ValueError` when it wasn't in `inheritable_handlers`. The fix ensures the method checks for the handler’s presence in each list before attempting removal, making it more robust while preserving its original behavior. **Issue:** Fixes #30640 **Dependencies:** None --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>