86ef758a9a
In _handle_api_error(), when a 429 rate-limit is encountered, the code calls available_api_keys.remove(chosen_key). If the same key was already removed in a previous retry iteration (e.g. the key rotated back to the same value), this raises ValueError which crashes the entire LLM request with an opaque error instead of a proper retry/fallback. Add a membership check before calling remove() to prevent the crash. Co-authored-by: easonysliu <easonysliu@tencent.com>