[GH-ISSUE #8290] Bug: KeyError: 'API_KEY_ALLOWED_PATHS' #30597

Closed
opened 2026-04-25 04:50:32 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @almajo on GitHub (Jan 3, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8290

Originally assigned to: @tjbck on GitHub.

Bug Report

Environment

  • Open WebUI Version:: 0.5.3

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.
  • I have included the browser console logs.
  • [X ] I have included the Docker container logs.
  • [X ] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

I want to call some api routes that are not automatically available through the new api restrictions. I expect this to work.

Actual Behavior:

There is an error that the key is not existing

Description

Bug Summary:
I used the user interface to activate the newly introduced API-Key restrictions and specified some paths. However, the app throws a Key Error because it can't find the 'API_KEY_ALLOWED_PATHS'.

Reproduction Details

Steps to Reproduce:

  1. Run webui 0.5.3
  2. Activate the 'API Key Endpoint Restrictions' under Settings > General
  3. Specify some routes below, e.g. /api/models,/api/v1/pipelines/list
  4. Call the API, e.g. /api/v1/pipelines/list

Logs and Screenshots

2025-01-03T09:13:31.3679889Z   File "/usr/local/lib/python3.11/site-packages/fastapi/dependencies/utils.py", line 572, in solve_dependencies
2025-01-03T09:13:31.3680023Z     solved_result = await solve_dependencies(
2025-01-03T09:13:31.3680117Z                     ^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-03T09:13:31.3680217Z   File "/usr/local/lib/python3.11/site-packages/fastapi/dependencies/utils.py", line 602, in solve_dependencies
2025-01-03T09:13:31.3680351Z     solved = await run_in_threadpool(call, **sub_values)
2025-01-03T09:13:31.3680448Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-03T09:13:31.3680570Z   File "/usr/local/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
2025-01-03T09:13:31.3680686Z     return await anyio.to_thread.run_sync(func, *args)
2025-01-03T09:13:31.3680782Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-03T09:13:31.3680899Z   File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
2025-01-03T09:13:31.3681018Z     return await get_async_backend().run_sync_in_worker_thread(
2025-01-03T09:13:31.3681131Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-03T09:13:31.3681232Z   File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2505, in run_sync_in_worker_thread
2025-01-03T09:13:31.3681349Z     return await future
2025-01-03T09:13:31.3681463Z            ^^^^^^^^^^^^
2025-01-03T09:13:31.3681564Z   File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 1005, in run
2025-01-03T09:13:31.3681673Z     result = context.run(func, *args)
2025-01-03T09:13:31.3681785Z              ^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-03T09:13:31.3681997Z   File "/app/backend/open_webui/utils/auth.py", line 102, in get_current_user
2025-01-03T09:13:31.3682136Z     for path in str(request.app.state.config.API_KEY_ALLOWED_PATHS).split(
2025-01-03T09:13:31.3682237Z                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-03T09:13:31.3682336Z   File "/app/backend/open_webui/config.py", line 262, in __getattr__
2025-01-03T09:13:31.3682466Z     return self._state[key].value
2025-01-03T09:13:31.3682561Z            ~~~~~~~~~~~^^^^^
2025-01-03T09:13:31.3682675Z KeyError: 'API_KEY_ALLOWED_PATHS'
2025-01-03T09:14:30.2319727Z INFO:    <IP> - "GET /api/models HTTP/1.1" 500 Internal Server Error
Originally created by @almajo on GitHub (Jan 3, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/8290 Originally assigned to: @tjbck on GitHub. # Bug Report ## Environment - **Open WebUI Version:**: 0.5.3 **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. - [ ] I have included the browser console logs. - [X ] I have included the Docker container logs. - [X ] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: I want to call some api routes that are not automatically available through the new api restrictions. I expect this to work. ## Actual Behavior: There is an error that the key is not existing ## Description **Bug Summary:** I used the user interface to activate the newly introduced API-Key restrictions and specified some paths. However, the app throws a Key Error because it can't find the 'API_KEY_ALLOWED_PATHS'. ## Reproduction Details **Steps to Reproduce:** 1. Run webui 0.5.3 2. Activate the 'API Key Endpoint Restrictions' under Settings > General 3. Specify some routes below, e.g. `/api/models,/api/v1/pipelines/list` 4. Call the API, e.g. `/api/v1/pipelines/list` ## Logs and Screenshots ```bash 2025-01-03T09:13:31.3679889Z File "/usr/local/lib/python3.11/site-packages/fastapi/dependencies/utils.py", line 572, in solve_dependencies 2025-01-03T09:13:31.3680023Z solved_result = await solve_dependencies( 2025-01-03T09:13:31.3680117Z ^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-01-03T09:13:31.3680217Z File "/usr/local/lib/python3.11/site-packages/fastapi/dependencies/utils.py", line 602, in solve_dependencies 2025-01-03T09:13:31.3680351Z solved = await run_in_threadpool(call, **sub_values) 2025-01-03T09:13:31.3680448Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-01-03T09:13:31.3680570Z File "/usr/local/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool 2025-01-03T09:13:31.3680686Z return await anyio.to_thread.run_sync(func, *args) 2025-01-03T09:13:31.3680782Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-01-03T09:13:31.3680899Z File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync 2025-01-03T09:13:31.3681018Z return await get_async_backend().run_sync_in_worker_thread( 2025-01-03T09:13:31.3681131Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-01-03T09:13:31.3681232Z File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2505, in run_sync_in_worker_thread 2025-01-03T09:13:31.3681349Z return await future 2025-01-03T09:13:31.3681463Z ^^^^^^^^^^^^ 2025-01-03T09:13:31.3681564Z File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 1005, in run 2025-01-03T09:13:31.3681673Z result = context.run(func, *args) 2025-01-03T09:13:31.3681785Z ^^^^^^^^^^^^^^^^^^^^^^^^ 2025-01-03T09:13:31.3681997Z File "/app/backend/open_webui/utils/auth.py", line 102, in get_current_user 2025-01-03T09:13:31.3682136Z for path in str(request.app.state.config.API_KEY_ALLOWED_PATHS).split( 2025-01-03T09:13:31.3682237Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-01-03T09:13:31.3682336Z File "/app/backend/open_webui/config.py", line 262, in __getattr__ 2025-01-03T09:13:31.3682466Z return self._state[key].value 2025-01-03T09:13:31.3682561Z ~~~~~~~~~~~^^^^^ 2025-01-03T09:13:31.3682675Z KeyError: 'API_KEY_ALLOWED_PATHS' 2025-01-03T09:14:30.2319727Z INFO: <IP> - "GET /api/models HTTP/1.1" 500 Internal Server Error ```
Author
Owner

@almajo commented on GitHub (Jan 3, 2025):

Obviously it's a naming issue as it should be called 'API_KEY_ALLOWED_ENDPOINTS'. I can't see commit 99386bf resolving this in the upcoming version of #8246 ?

<!-- gh-comment-id:2568980870 --> @almajo commented on GitHub (Jan 3, 2025): Obviously it's a naming issue as it should be called 'API_KEY_ALLOWED_ENDPOINTS'. I can't see commit 99386bf resolving this in the upcoming version of #8246 ?
Author
Owner

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

Good catch, fixed on dev!

<!-- gh-comment-id:2569820513 --> @tjbck commented on GitHub (Jan 3, 2025): Good catch, fixed on dev!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#30597