6 views
-/https://github.com/berriai/litellm/issues/29391
GitHub · issue

#29391 [Bug]: github_copilot provider: IndexError (list index out of range) when max_tokens=1 for newer Claude models (opus-4.7, opus-4.8)

  • State: open
  • Author: @BeginnerRudy
  • Labels: llm translation, claude code

## What happened?

When sending a request with `max_tokens=1` to newer Claude models (`claude-opus-4.7`, `claude-opus-4.8`) via the `github_copilot` provider, LiteLLM returns HTTP 500 with:

```json {"error":{"message":"list index out of range","type":"None","param":"None","code":"500"}} ```

The same request with `max_tokens=2` or higher works perfectly. This breaks **Claude Code's model validation**, which hardcodes `max_tokens:1` as a probe to check if a model is usable.

## Relevant log output

Response headers on the 500: ``` server: uvicorn x-litellm-version: 1.81.3 x-litellm-call-id: 84fd88ec-6c5f-415f-a15c-76e4ef73481f x-litellm-model-id: 7b4da4cc-f571-4e47-b361-c40b0422815b x-litellm-response-cost: 0 ```

The error is a Python `IndexError` originating inside litellm (not from the upstream Copilot backend), as evidenced by `server: uvicorn` and `x-litellm-response-cost: 0` (no upstream completion was processed).

## How to reproduce

```bash # FAILS (500) curl -s "$LITELLM_BASE/v1/messages" \ -H "Authorization: Bearer $KEY" \ -H "content-type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{"model":"claude-opus-4.7","max_tokens":1,"messages":[{"role":"…

GitHub resolver

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

Refresh page
vote history (3 events)
#0 of 0 · 31d19h3m30s ago — entered · #import:https:::github.com:berriai:litellm post #1794
The left issue is harder because it involves provider-specific request translation, edge-case handling, upstream compatibility, and regression testing across model variants. The right issue is comparatively localized to proxy invitation-link construction and associated email-flow tests.
The left issue is harder because it crosses provider parsing, metadata normalization, logging, and observability integrations, requiring coordination across multiple data paths and compatibility tests. The right issue is more likely a localized provider translation or bounds-handling fix with focused regression coverage.
#0 of 0 · 31d17h42m55s ago — current · #import:https:::github.com:berriai:litellm post #3147
The left issue spans proxy configuration, A2A authentication propagation, and separate invocation paths, requiring cross-layer debugging and regression coverage. The right issue appears more localized to provider-side edge-case handling and a focused fix.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search