7 views
-/https://github.com/berriai/litellm/issues/26913
GitHub · issue

#26913 [Bug]: `MidStreamFallbackError` crashes with `ValueError: invalid literal for int() with base 10: 'litellm_error'`

  • State: open
  • Author: @yogeek
  • Labels: bug, proxy, llm translation, stale

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

### Description

When a `CustomLLM` handler raises `RateLimitError` during a streaming request, LiteLLM's `MidStreamFallbackError.__init__` crashes because it receives the string `'litellm_error'` as `original_status` and tries to cast it to `int`.

The crash is in `litellm/exceptions.py:957`:

```python self.status_code = int(original_status) if original_status is not None else 503 ```

This returns HTTP 500 to the client instead of triggering the fallback chain.

### Steps to Reproduce

1. Register a custom provider with a `CustomLLM` handler 2. In the handler's `astreaming` method, raise `RateLimitError` 3. Configure fallbacks for the model group 4. Send a streaming request

**Minimal custom handler:**

```python from litellm import CustomLLM, RateLimitError

class MyHandler(CustomLLM): async def acompletion(self, *args, **kwargs): raise RateLimitError( message="Key exhausted", model="my-model", llm_provider="openai", )

async def astreaming(self, *args, **kwargs): # This tr…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d17h58m37s ago — entered · #import:https:::github.com:berriai:litellm post #2900
26913 requires diagnosing and safely fixing failure propagation across streaming, custom handlers, exception normalization, and fallback execution, with regression coverage. 29400 provides no actionable technical scope, so its implementation effort appears minimal or indeterminate.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search