[GH-ISSUE #8526] IndexError: list index out of range #85898

Closed
opened 2026-05-15 10:27:05 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @c0st1nus on GitHub (Jan 13, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8526

Bug Report

I'm using openrouter api key (100% sure that there is no problem from provider side). During message to Claude 3.5 Sonnet or any other model I get nothing, the infinity load animation only.

Important Notes

I saw a completed request with answer body:

{
    "model": "anthropic/claude-3.5-sonnet",
    "messages": [
        {
            "id": "7c175afe-7731-49c0-8cc3-f2392e75f2f5",
            "role": "user",
            "content": "Hello!",
            "timestamp": 1736793345
        },
        {
            "id": "e8efb27b-01ee-45a7-842e-4e95e11c9016",
            "role": "assistant",
            "content": "",
            "timestamp": 1736793345
        }
    ],
    "chat_id": "04c029d6-df5e-4f73-851d-c749a2d77fb9",
    "session_id": "zR7WFQhJ50GaLuODAAAN",
    "id": "e8efb27b-01ee-45a7-842e-4e95e11c9016"
}

There was answer alarm also.

Installation Method

I installed open-webui interface using docker-compose:

version: '3.8'

services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    ports:
      - "3000:8080"
    volumes:
      - ./db:/app/backend/data
    restart: always

Otherwise interface works excellent

Environment

Open WebUI v0.5.4
OpenRouter API key
Operating System: Debian
Browser (if applicable): Firefox 134.0

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

The model answer message is supposed to be.

Actual Behavior:

The model does not answers at all.

Logs and Screenshots

изображение
изображение
изображение

Browser Console Logs:

Completion console log

Object { chat_id: "04c029d6-df5e-4f73-851d-c749a2d77fb9", message_id: "e8efb27b-01ee-45a7-842e-4e95e11c9016", data: {…} }
​
chat_id: "04c029d6-df5e-4f73-851d-c749a2d77fb9"
​
data: Object { type: "chat:completion", data: {…} }
​​
data: Object { done: true, content: "", title: "Новый чат" }
​​​
content: ""
​​​
done: true
​​​
title: "Новый чат"
​​​
<prototype>: Object { … }
​​
type: "chat:completion"
​​
<prototype>: Object { … }
​
message_id: "e8efb27b-01ee-45a7-842e-4e95e11c9016"
​
<prototype>: Object { … }
Chat.svelte:226:10

Docker Container Logs:

ERROR [asyncio] Task exception was never retrieved
future: <Task finished name='Task-2347' coro=<process_chat_response.<locals>.post_response_handler() done, defined at /app/backend/open_webui/utils/middleware.py:932> exception=IndexError('list index out of range')>
Traceback (most recent call last):
  File "/app/backend/open_webui/utils/middleware.py", line 1057, in post_response_handler
    await background_tasks_handler()
  File "/app/backend/open_webui/utils/middleware.py", line 819, in background_tasks_handler
    res.get("choices", [])[0]
    ~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
ERROR [asyncio] Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f7418783490>
ERROR [asyncio] Unclosed connector
connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x7f7418b800c0>, 2180191.947391675)])']
connector: <aiohttp.connector.TCPConnector object at 0x7f7418792890>
Originally created by @c0st1nus on GitHub (Jan 13, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/8526 # Bug Report I'm using openrouter api key (100% sure that there is no problem from provider side). During message to Claude 3.5 Sonnet or any other model I get nothing, the infinity load animation only. ## Important Notes I saw a `completed` request with answer body: ``` { "model": "anthropic/claude-3.5-sonnet", "messages": [ { "id": "7c175afe-7731-49c0-8cc3-f2392e75f2f5", "role": "user", "content": "Hello!", "timestamp": 1736793345 }, { "id": "e8efb27b-01ee-45a7-842e-4e95e11c9016", "role": "assistant", "content": "", "timestamp": 1736793345 } ], "chat_id": "04c029d6-df5e-4f73-851d-c749a2d77fb9", "session_id": "zR7WFQhJ50GaLuODAAAN", "id": "e8efb27b-01ee-45a7-842e-4e95e11c9016" } ``` There was answer alarm also. ## Installation Method I installed open-webui interface using docker-compose: ```docker-compose.yaml version: '3.8' services: open-webui: image: ghcr.io/open-webui/open-webui:main container_name: open-webui ports: - "3000:8080" volumes: - ./db:/app/backend/data restart: always ``` Otherwise interface works excellent ## Environment Open WebUI v0.5.4 OpenRouter API key **Operating System:** Debian **Browser (if applicable):** Firefox 134.0 **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I am on the latest version of both Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [ ] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: The model answer message is supposed to be. ## Actual Behavior: The model does not answers at all. ## Logs and Screenshots ![изображение](https://github.com/user-attachments/assets/a94c16ed-c5a7-4f0c-b763-56bd856753fc) ![изображение](https://github.com/user-attachments/assets/1dc92ba2-eebd-4a80-89a6-4cf48599b279) ![изображение](https://github.com/user-attachments/assets/d52f0c27-cf35-4afc-801b-b82f1bd801ab) **Browser Console Logs:** Completion console log ``` Object { chat_id: "04c029d6-df5e-4f73-851d-c749a2d77fb9", message_id: "e8efb27b-01ee-45a7-842e-4e95e11c9016", data: {…} } ​ chat_id: "04c029d6-df5e-4f73-851d-c749a2d77fb9" ​ data: Object { type: "chat:completion", data: {…} } ​​ data: Object { done: true, content: "", title: "Новый чат" } ​​​ content: "" ​​​ done: true ​​​ title: "Новый чат" ​​​ <prototype>: Object { … } ​​ type: "chat:completion" ​​ <prototype>: Object { … } ​ message_id: "e8efb27b-01ee-45a7-842e-4e95e11c9016" ​ <prototype>: Object { … } Chat.svelte:226:10 ``` **Docker Container Logs:** ``` ERROR [asyncio] Task exception was never retrieved future: <Task finished name='Task-2347' coro=<process_chat_response.<locals>.post_response_handler() done, defined at /app/backend/open_webui/utils/middleware.py:932> exception=IndexError('list index out of range')> Traceback (most recent call last): File "/app/backend/open_webui/utils/middleware.py", line 1057, in post_response_handler await background_tasks_handler() File "/app/backend/open_webui/utils/middleware.py", line 819, in background_tasks_handler res.get("choices", [])[0] ~~~~~~~~~~~~~~~~~~~~~~^^^ IndexError: list index out of range ERROR [asyncio] Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7f7418783490> ERROR [asyncio] Unclosed connector connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x7f7418b800c0>, 2180191.947391675)])'] connector: <aiohttp.connector.TCPConnector object at 0x7f7418792890> ```
Author
Owner

@c0st1nus commented on GitHub (Jan 13, 2025):

Would like to prove the absence of errors from provider side

import requests
import json

response = requests.post(
  url="https://openrouter.ai/api/v1/chat/completions",
  headers={
    "Authorization": "Bearer (( SAME API KEY LIKE IN WEBUI IS ))",
  },
  data=json.dumps({
    "model": "openai/gpt-3.5-turbo",
    "messages": [
      {
        "role": "user",
        "content": "What is the meaning of life?"
      }
    ]
    
  })
)

print(response.json())
python main.py
{'id': 'gen-1736791728-URixFEq17eLdVi0xoUWU', 'provider': 'OpenAI', 'model': 'openai/gpt-3.5-turbo', 'object': 'chat.completion', 'created': 1736791728, 'choices': [{'logprobs': None, 'finish_reason': 'stop', 'index': 0, 'message': {'role': 'assistant', 'content': 'The meaning of life is a philosophical question that has been debated by scholars, theologians, and individuals throughout history. Different people and cultures have different beliefs about the purpose and meaning of life. Some believe that the meaning of life is to seek happiness and fulfillment, others believe it is to serve a higher power or spiritual purpose, and still others believe 
that life has no inherent meaning and it is up to each individual to create their own meaning. Ultimately, the meaning of life is a deeply personal and subjective question that each person must grapple with and answer for themselves.', 'refusal': ''}}], 'system_fingerprint': None, 
'usage': {'prompt_tokens': 14, 'completion_tokens': 113, 'total_tokens': 127}}
<!-- gh-comment-id:2587948827 --> @c0st1nus commented on GitHub (Jan 13, 2025): Would like to prove the absence of errors from provider side ```Python import requests import json response = requests.post( url="https://openrouter.ai/api/v1/chat/completions", headers={ "Authorization": "Bearer (( SAME API KEY LIKE IN WEBUI IS ))", }, data=json.dumps({ "model": "openai/gpt-3.5-turbo", "messages": [ { "role": "user", "content": "What is the meaning of life?" } ] }) ) print(response.json()) ``` ```Result python main.py {'id': 'gen-1736791728-URixFEq17eLdVi0xoUWU', 'provider': 'OpenAI', 'model': 'openai/gpt-3.5-turbo', 'object': 'chat.completion', 'created': 1736791728, 'choices': [{'logprobs': None, 'finish_reason': 'stop', 'index': 0, 'message': {'role': 'assistant', 'content': 'The meaning of life is a philosophical question that has been debated by scholars, theologians, and individuals throughout history. Different people and cultures have different beliefs about the purpose and meaning of life. Some believe that the meaning of life is to seek happiness and fulfillment, others believe it is to serve a higher power or spiritual purpose, and still others believe that life has no inherent meaning and it is up to each individual to create their own meaning. Ultimately, the meaning of life is a deeply personal and subjective question that each person must grapple with and answer for themselves.', 'refusal': ''}}], 'system_fingerprint': None, 'usage': {'prompt_tokens': 14, 'completion_tokens': 113, 'total_tokens': 127}} ```
Author
Owner

@rgaricano commented on GitHub (Jan 14, 2025):

Another issue related: OpenAI: o1-mini doesn't work through openrouter #8474

<!-- gh-comment-id:2589052255 --> @rgaricano commented on GitHub (Jan 14, 2025): Another issue related: [OpenAI: o1-mini doesn't work through openrouter #8474](https://github.com/open-webui/open-webui/issues/8474#issue-2781461882)
Author
Owner

@tjbck commented on GitHub (Jan 16, 2025):

This should've been addressed in dev, testing wanted here!

<!-- gh-comment-id:2594746241 --> @tjbck commented on GitHub (Jan 16, 2025): This should've been addressed in dev, testing wanted here!
Author
Owner

@feronetick commented on GitHub (Feb 18, 2025):

What's the result here? Should we wait any changes?

<!-- gh-comment-id:2664838100 --> @feronetick commented on GitHub (Feb 18, 2025): What's the result here? Should we wait any changes?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#85898