[GH-ISSUE #511] TypeError: list indices must be integers or slices, not str when using Pipelines in v0.6.5 #234

Open
opened 2026-10-18 21:03:56 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @hirokawaguchi on GitHub (Apr 21, 2025).
Original GitHub issue: https://github.com/open-webui/pipelines/issues/511

Describe the bug
When attempting to use any pipeline (even a minimal one) via the /api/chat/completions endpoint, OpenWebUI v0.6.5 throws a TypeError: list indices must be integers or slices, not str. This results in a 400 Bad Request response, and the pipeline code itself is never executed. The error seems to occur within the main OpenWebUI backend code while processing the request before dispatching it to the pipeline server. Regular models (non-pipeline) work correctly.

To Reproduce

  1. Set up OpenWebUI v0.6.5 with the pipeline server enabled.
  2. Create a minimal pipeline file (e.g., hello.py in the pipelines directory) like the simplified one below:
    # pipelines/hello.py
    """
    name: Hello Simplified
    description: A minimal pipeline for testing.
    """
    from typing import List, Union, Generator, Iterator
    from pprint import pprint
    
    class Pipeline:
        def __init__(self):
            self.name: str = "Hello Simplified"
            self.debug: bool = True
    
        async def on_startup(self):
            print(f"[{self.name}] on_startup")
    
        async def on_shutdown(self):
            print(f"[{self.name}] on_shutdown")
    
        def pipe(
            self,
            user_message: str,
            model_id: str,
            messages: List[dict],
            body: Union[dict, list],
        ) -> Union[str, Generator, Iterator]:
            print(f"[{self.name}] pipe function called.") # This line is never reached
            pprint(user_message)
            pprint(model_id)
            pprint(messages)
            pprint(body)
            return f"Simplified Hello! You sent: {user_message}"
    
  3. Enable DEBUG logging for the main open-webui container (e.g., set GLOBAL_LOG_LEVEL=DEBUG in docker-compose.yaml).
  4. Restart OpenWebUI.
  5. In the Web UI, select the "Hello Simplified" pipeline as the model.
  6. Send any chat message (e.g., "Hello").
  7. Observe the 400 Bad Request error in the UI and the browser's network console.
  8. Check the logs for the main open-webui container.

Expected behavior
The /api/chat/completions request should succeed (return 200 OK), and the pipeline's pipe method should be called, processing the message and returning a response. The pipeline server logs should show the pipe function called. message.

Actual behavior
The request fails with a 400 Bad Request. The open-webui container log shows the following DEBUG messages just before the error, indicating the error occurs within the main backend when processing the chat payload for a pipeline model:

2025-04-21 07:38:54.543 | DEBUG    | open_webui.utils.middleware:process_chat_payload:688 - form_data: {'stream': True, 'model': 'hello', 'messages': [{'role': 'user', 'content': 'こんにちは'}], ... , 'model': {'id': 'hello', 'name': 'Hello Simplified', ... 'pipeline': {'type': 'pipe', ...}, ...}} - {}
2025-04-21 07:38:54.543 | DEBUG    | open_webui.main:chat_completion:1135 - Error processing chat payload: list indices must be integers or slices, not str - {}
2025-04-21 07:38:54.545 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - ... - "POST /api/chat/completions HTTP/1.1" 400 - {}

(Note: Some parts of the log like user ID, chat ID, full form_data details, etc., were truncated for brevity)

The pipeline server (open-webui-pipelines-1 container) logs show the on_startup message but never receive the request to execute the pipe method.

Environment details

  • OS: [docker(colima) on macOS Sonoma]
  • Browser: [Chrome 135.0.7049.96]
  • OpenWebUI Version: v0.6.5
  • Deployment method: Docker Compose

Additional context
This issue seems specific to the pipeline functionality introduced/updated around v0.6.x. Using standard LLMs (not pipelines) works correctly, and the /api/chat/completions endpoint returns a 200 OK status for them. The error occurs regardless of the complexity of the pipeline code itself.

Originally created by @hirokawaguchi on GitHub (Apr 21, 2025). Original GitHub issue: https://github.com/open-webui/pipelines/issues/511 **Describe the bug** When attempting to use any pipeline (even a minimal one) via the `/api/chat/completions` endpoint, OpenWebUI v0.6.5 throws a `TypeError: list indices must be integers or slices, not str`. This results in a `400 Bad Request` response, and the pipeline code itself is never executed. The error seems to occur within the main OpenWebUI backend code while processing the request *before* dispatching it to the pipeline server. Regular models (non-pipeline) work correctly. **To Reproduce** 1. Set up OpenWebUI v0.6.5 with the pipeline server enabled. 2. Create a minimal pipeline file (e.g., `hello.py` in the `pipelines` directory) like the simplified one below: ```python # pipelines/hello.py """ name: Hello Simplified description: A minimal pipeline for testing. """ from typing import List, Union, Generator, Iterator from pprint import pprint class Pipeline: def __init__(self): self.name: str = "Hello Simplified" self.debug: bool = True async def on_startup(self): print(f"[{self.name}] on_startup") async def on_shutdown(self): print(f"[{self.name}] on_shutdown") def pipe( self, user_message: str, model_id: str, messages: List[dict], body: Union[dict, list], ) -> Union[str, Generator, Iterator]: print(f"[{self.name}] pipe function called.") # This line is never reached pprint(user_message) pprint(model_id) pprint(messages) pprint(body) return f"Simplified Hello! You sent: {user_message}" ``` 3. Enable DEBUG logging for the main `open-webui` container (e.g., set `GLOBAL_LOG_LEVEL=DEBUG` in `docker-compose.yaml`). 4. Restart OpenWebUI. 5. In the Web UI, select the "Hello Simplified" pipeline as the model. 6. Send any chat message (e.g., "Hello"). 7. Observe the `400 Bad Request` error in the UI and the browser's network console. 8. Check the logs for the main `open-webui` container. **Expected behavior** The `/api/chat/completions` request should succeed (return 200 OK), and the pipeline's `pipe` method should be called, processing the message and returning a response. The pipeline server logs should show the `pipe function called.` message. **Actual behavior** The request fails with a `400 Bad Request`. The `open-webui` container log shows the following DEBUG messages just before the error, indicating the error occurs within the main backend when processing the chat payload for a pipeline model: ```log 2025-04-21 07:38:54.543 | DEBUG | open_webui.utils.middleware:process_chat_payload:688 - form_data: {'stream': True, 'model': 'hello', 'messages': [{'role': 'user', 'content': 'こんにちは'}], ... , 'model': {'id': 'hello', 'name': 'Hello Simplified', ... 'pipeline': {'type': 'pipe', ...}, ...}} - {} 2025-04-21 07:38:54.543 | DEBUG | open_webui.main:chat_completion:1135 - Error processing chat payload: list indices must be integers or slices, not str - {} 2025-04-21 07:38:54.545 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - ... - "POST /api/chat/completions HTTP/1.1" 400 - {} ``` *(Note: Some parts of the log like user ID, chat ID, full form_data details, etc., were truncated for brevity)* The pipeline server (`open-webui-pipelines-1` container) logs show the `on_startup` message but never receive the request to execute the `pipe` method. **Environment details** * OS: [docker(colima) on macOS Sonoma] * Browser: [Chrome 135.0.7049.96] * OpenWebUI Version: v0.6.5 * Deployment method: Docker Compose **Additional context** This issue seems specific to the pipeline functionality introduced/updated around v0.6.x. Using standard LLMs (not pipelines) works correctly, and the `/api/chat/completions` endpoint returns a 200 OK status for them. The error occurs regardless of the complexity of the pipeline code itself.
Author
Owner

@MichelDucartier commented on GitHub (May 2, 2025):

In case if anyone stumbles on this, the issue seems to linked to this part in open-webui:

urlIdx = filter.get("urlIdx")
if urlIdx is None:
     continue

url = request.app.state.config.OPENAI_API_BASE_URLS[urlIdx]
key = request.app.state.config.OPENAI_API_KEYS[urlIdx]

urlIdx is a str and needs to be cast to int

<!-- gh-comment-id:2847051576 --> @MichelDucartier commented on GitHub (May 2, 2025): In case if anyone stumbles on this, the issue seems to linked to this [part in open-webui](https://github.com/open-webui/open-webui/blob/852d9dcbe9b4406e1da230a14642f35ac7bb0d2b/backend/open_webui/routers/pipelines.py#L71): ```py urlIdx = filter.get("urlIdx") if urlIdx is None: continue url = request.app.state.config.OPENAI_API_BASE_URLS[urlIdx] key = request.app.state.config.OPENAI_API_KEYS[urlIdx] ``` urlIdx is a str and needs to be cast to int
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/pipelines#234
No description provided.