mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-22 01:55:27 -04:00
🐛 Tongyi LLM plugin incorrectly handles provider error responses #610
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @laipz8200 on GitHub (Sep 2, 2025).
Originally assigned to: @laipz8200 on GitHub.
Current Behavior:
The Tongyi LLM plugin currently treats all API error responses as regardless of the actual HTTP status code returned by the provider.
Expected Behavior:
Different HTTP status codes should be mapped to appropriate error types:
Impact:
This affects proper error handling and user experience when using the Tongyi LLM plugin, as users cannot distinguish between different types of errors (authentication issues, rate limits, bad requests, etc.).
Environment:
@dosubot[bot] commented on GitHub (Sep 2, 2025):
You're right—currently, the Tongyi LLM plugin treats all provider error responses as ServiceUnavailableError, regardless of the actual HTTP status code. The error handling logic in the plugin's code raises ServiceUnavailableError for any non-200 response, without distinguishing between authentication, rate limit, bad request, or server errors. Although there's an _invoke_error_mapping property defined to map errors, it's not actually used in the main error handling flow, so error types aren't differentiated as expected see code reference.
To improve this, you could update the error handling in the _handle_generate_response and _handle_generate_stream_response methods to check the HTTP status code and raise the appropriate error type (e.g., BadRequestError for 400/422, AuthorizationError for 401/403, RateLimitError for 429, ServerUnavailableError for 500+). The spider plugin recently implemented a similar pattern for clearer error mapping, which could serve as a reference example.
Let me know if you want a sample code snippet for this!
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
