Fix issue #3165: Enhanced error handling for custom OpenAI-compatible endpoints #3166
+326
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix issue #3165: Enhanced error handling for custom OpenAI-compatible endpoints
Summary
This PR addresses issue #3165 where CrewAI showed generic "❌ LLM Failed" errors instead of propagating specific error details from custom OpenAI-compatible endpoints. The fix enhances the error handling system to capture and display detailed error information including error types, original error messages, and endpoint context.
Key Changes:
LLMCallFailedEvent
with new optional fields:error_type
,original_error
,endpoint_info
LLM.call()
exception handling to capture detailed error information for custom endpointsBefore: Generic "❌ LLM Failed" message with no actionable details
After: Specific error information like "ConnectionError: Failed to establish connection" with endpoint details
Review & Testing Checklist for Human
🔴 High Priority (3 items)
🟡 Medium Priority (2 items)
error
field still functions normallyRecommended End-to-End Test Plan:
python reproduce_issue_3165.py
to verify the fixbase_url="https://invalid-endpoint.com/v1"
)Diagram
Notes
LLMCallFailedEvent
are optional, maintaining compatibility with existing code