mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
Tongyi LLM plugin incorrectly handles provider error responses #613
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 ServiceUnavailableError 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 correct—the Tongyi LLM plugin currently raises a ServiceUnavailableError for any non-200 response, regardless of the actual HTTP status code. This logic is in the TongyiLLMModel class's _chat method, and there isn't any mapping for specific status codes to error types like BadRequestError, AuthorizationError, or RateLimitError, which leads to ambiguous error reporting for users source.
To improve error handling, you can update the _chat method to check the response status code and raise the appropriate error type. For example: raise BadRequestError for 400/422, AuthorizationError for 401/403, RateLimitError for 429, and ServerUnavailableError for 500+. No recent pull requests address this, so a code change is needed in models/tongyi/models/llm/tongyi.py.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
