[GH-ISSUE #18356] issue: oracle23ai.py UnboundLocalError: cannot access local variable 'limit' where it is not associated with a value #18571

Closed
opened 2026-04-20 00:47:25 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @fatih-keles on GitHub (Oct 15, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18356

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.33

Ollama Version (if applicable)

0.12.3

Operating System

Ubuntu 24.04

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using 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 every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

Web search results to be passed to LLM

Actual Behavior

Web search results are not passed to LLM, we see error message in container log

Steps to Reproduce

  1. Start container with web search enabled
    docker run -d
      -p 3000:8080
      -v ollama:/root/.ollama
      -v open-webui:/app/backend/data
      -v /u01/oracle_wallet:/oracle_wallet
      --name open-webui
      --restart unless-stopped
      -e WEBUI_URL="https://"
      -e ENABLE_OAUTH_SIGNUP=False
      -e ENABLE_PERSISTENT_CONFIG=False
      -e VECTOR_DB=oracle23ai
      -e ORACLE_DB_USE_WALLET=True
      -e ORACLE_DB_USER=OPENWEBUI
      -e ORACLE_DB_PASSWORD=
      -e ORACLE_DB_DSN=kbvectorstore2_low
      -e ORACLE_WALLET_DIR=/oracle_wallet
      -e ORACLE_WALLET_PASSWORD=
      -e ORACLE_VECTOR_LENGTH=384
      -e ORACLE_DB_POOL_MIN=2
      -e ORACLE_DB_POOL_MAX=10
      -e ORACLE_DB_POOL_INCREMENT=1
      -e OAUTH_CLIENT_ID=""
      -e OAUTH_CLIENT_SECRET=""
      -e OPENID_PROVIDER_URL="https:///.well-known/openid-configuration"
      -e OAUTH_PROVIDER_NAME="OCI SSO"
      -e OAUTH_SCOPES="openid email profile"
      -e OPENID_REDIRECT_URI="https:///oauth/oidc/callback"
      -e ENABLE_WEB_SEARCH=True
      -e WEB_SEARCH_ENGINE=perplexity_search
      -e PERPLEXITY_API_KEY="pplx-"
      ghcr.io/open-webui/open-webui:ollama

  2. enable web search in a new chat and enter a prompt like "what's the weather like in Amsterdam"

  3. observe container logs.

Logs & Screenshots

2025-10-15 17:18:08.029 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 94.207.29.255:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200
[GIN] 2025/10/15 - 17:18:38 | 200 | 2m19s | 127.0.0.1 | POST "/api/chat"
Fetching pages: 100%|##########| 6/6 [00:02<00:00, 2.55it/s]
2025-10-15 17:18:44.803 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1262 - save_docs_to_vector_db: document Weather - Amsterdam - 14-Day Forecast: Temperature, Wind & Radar | Ventusky, Amsterdam, North Holland, Netherlands Weather Forecast | AccuWeather, Weather - The Hague - 14-Day Forecast: Temperature, Wind & Radar | Ventusky, 10-Day Weather Forecast for Frederik Hendrikbuurt, Amsterdam-West, North Holland, Netherlands - The Weather Channel | weather.com, Weather Forecast and Conditions for Burgwallen-Nieuwe Zijde, Amsterdam-Centrum, North Holland, Netherlands - The Weather Channel | Weather.com, Albany, New York News, Weather, Sports | NEWS10 ABC web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8
2025-10-15 17:18:44.829 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1378 - generating embeddings for web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8
Batches: 100%|██████████| 3/3 [00:01<00:00, 2.43it/s]
2025-10-15 17:18:46.078 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1414 - embeddings generated 86 for 86 items
2025-10-15 17:18:46.080 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1426 - adding to collection web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8
2025-10-15 17:18:46.081 | INFO | open_webui.retrieval.vector.dbs.oracle23ai:insert:421 - Inserting 86 items into collection 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'.
2025-10-15 17:18:46.240 | INFO | open_webui.retrieval.vector.dbs.oracle23ai:insert:446 - Successfully inserted 86 items into collection 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'.
2025-10-15 17:18:46.241 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1432 - added 86 items to collection web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8
2025-10-15 17:18:46.257 | ERROR | open_webui.retrieval.utils:get_doc:146 - Error getting doc web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8: cannot access local variable 'limit' where it is not associated with a value
Traceback (most recent call last):

File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x7506027549a0>
└ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function Thread.run at 0x750602754680>
└ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
File "/usr/local/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **self._kwargs)
│ │ │ │ │ └ {}
│ │ │ │ └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
│ │ │ └ (<weakref at 0x750493dfae30; to 'ThreadPoolExecutor' at 0x7504c1ec3050>, <_queue.SimpleQueue object at 0x750493b00950>, None,...
│ │ └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
│ └ <function _worker at 0x7506016565c0>
└ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 83, in _worker
work_item.run()
│ └ <function _WorkItem.run at 0x750601656700>
└ <concurrent.futures.thread._WorkItem object at 0x750493b2a910>
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
│ │ │ │ │ └ {}
│ │ │ │ └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910>
│ │ │ └ ()
│ │ └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910>
│ └ <function chat_completion_files_handler.. at 0x750493b0c900>
└ <concurrent.futures.thread._WorkItem object at 0x750493b2a910>

File "/app/backend/open_webui/utils/middleware.py", line 886, in
lambda: get_sources_from_items(
└ <function get_sources_from_items at 0x75055c21af20>

File "/app/backend/open_webui/retrieval/utils.py", line 728, in get_sources_from_items
query_result = get_all_items_from_collections(collection_names)
│ └ {'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'}
└ <function get_all_items_from_collections at 0x75055c21a520>

File "/app/backend/open_webui/retrieval/utils.py", line 312, in get_all_items_from_collections
result = get_doc(collection_name=collection_name)
│ └ 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'
└ <function get_doc at 0x75055c21a700>

File "/app/backend/open_webui/retrieval/utils.py", line 139, in get_doc
result = VECTOR_DB_CLIENT.get(collection_name=collection_name)
│ │ └ 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'
│ └ <function Oracle23aiClient.get at 0x7505659b6fc0>
└ <open_webui.retrieval.vector.dbs.oracle23ai.Oracle23aiClient object at 0x750566443350>

File "/app/backend/open_webui/retrieval/vector/dbs/oracle23ai.py", line 716, in get
f"Getting items from collection '{collection_name}' with limit {limit}."

UnboundLocalError: cannot access local variable 'limit' where it is not associated with a value
2025-10-15 17:18:46.259 | ERROR | open_webui.retrieval.utils:get_all_items_from_collections:316 - Error when querying the collection: cannot access local variable 'limit' where it is not associated with a value
Traceback (most recent call last):

File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x7506027549a0>
└ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function Thread.run at 0x750602754680>
└ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
File "/usr/local/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **self._kwargs)
│ │ │ │ │ └ {}
│ │ │ │ └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
│ │ │ └ (<weakref at 0x750493dfae30; to 'ThreadPoolExecutor' at 0x7504c1ec3050>, <_queue.SimpleQueue object at 0x750493b00950>, None,...
│ │ └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
│ └ <function _worker at 0x7506016565c0>
└ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)>
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 83, in _worker
work_item.run()
│ └ <function _WorkItem.run at 0x750601656700>
└ <concurrent.futures.thread._WorkItem object at 0x750493b2a910>
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
│ │ │ │ │ └ {}
│ │ │ │ └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910>
│ │ │ └ ()
│ │ └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910>
│ └ <function chat_completion_files_handler.. at 0x750493b0c900>
└ <concurrent.futures.thread._WorkItem object at 0x750493b2a910>

File "/app/backend/open_webui/utils/middleware.py", line 886, in
lambda: get_sources_from_items(
└ <function get_sources_from_items at 0x75055c21af20>

File "/app/backend/open_webui/retrieval/utils.py", line 728, in get_sources_from_items
query_result = get_all_items_from_collections(collection_names)
│ └ {'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'}
└ <function get_all_items_from_collections at 0x75055c21a520>

File "/app/backend/open_webui/retrieval/utils.py", line 312, in get_all_items_from_collections
result = get_doc(collection_name=collection_name)
│ └ 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'
└ <function get_doc at 0x75055c21a700>

File "/app/backend/open_webui/retrieval/utils.py", line 147, in get_doc
raise e

File "/app/backend/open_webui/retrieval/utils.py", line 139, in get_doc
result = VECTOR_DB_CLIENT.get(collection_name=collection_name)
│ │ └ 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'
│ └ <function Oracle23aiClient.get at 0x7505659b6fc0>
└ <open_webui.retrieval.vector.dbs.oracle23ai.Oracle23aiClient object at 0x750566443350>

File "/app/backend/open_webui/retrieval/vector/dbs/oracle23ai.py", line 716, in get
f"Getting items from collection '{collection_name}' with limit {limit}."

UnboundLocalError: cannot access local variable 'limit' where it is not associated with a value
2025-10-15 17:18:53.691 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 94.207.29.255:0 - "GET /_app/version.json HTTP/1.1" 200
[GIN] 2025/10/15 - 17:19:01 | 200 | 54.354498778s | 127.0.0.1 | POST "/api/chat"

Additional Information

open-webui/backend/open_webui/retrieval/vector/dbs/oracle23ai.py

local variable limit is missing in procedure get

def get(self, collection_name: str) -> Optional[GetResult]:
"""
Get all items in a collection.

    Retrieves items from a specified collection up to the limit.

    Args:
        collection_name (str): Name of the collection to retrieve
        limit (Optional[int]): Maximum number of items to retrieve

    Returns:
        Optional[GetResult]: Result containing ids, documents, and metadata

    Example:
        >>> client = Oracle23aiClient()
        >>> results = client.get("my_collection", limit=50)
        >>> if results:
        ...     print(f"Retrieved {len(results.ids[0])} documents from collection")
    """
    log.info(
        f"Getting items from collection '{collection_name}' with limit {limit}."
    )

    try:
        limit = limit or 1000

        with self.get_connection() as connection:
            with connection.cursor() as cursor:
                cursor.execute(
                    """
                    SELECT /*+ MONITOR */ id, text, JSON_SERIALIZE(vmetadata RETURNING VARCHAR2(4096)) as vmetadata
                    FROM document_chunk
                    WHERE collection_name = :collection_name
                    FETCH FIRST :limit ROWS ONLY
                """,
                    {"collection_name": collection_name, "limit": limit},
                )

                results = cursor.fetchall()

        if not results:
            log.info("No results found.")
            return None

        ids = [[row[0] for row in results]]
        documents = [
            [
                row[1].read() if isinstance(row[1], oracledb.LOB) else str(row[1])
                for row in results
            ]
        ]
        # 🔧 FIXED: Parse JSON metadata properly
        metadatas = [
            [
                self._json_to_metadata(
                    row[2].read() if isinstance(row[2], oracledb.LOB) else row[2]
                )
                for row in results
            ]
        ]

        return GetResult(ids=ids, documents=documents, metadatas=metadatas)

    except Exception as e:
        log.exception(f"Error during get: {e}")
        return None
Originally created by @fatih-keles on GitHub (Oct 15, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/18356 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.33 ### Ollama Version (if applicable) 0.12.3 ### Operating System Ubuntu 24.04 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using 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. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior Web search results to be passed to LLM ### Actual Behavior Web search results are not passed to LLM, we see error message in container log ### Steps to Reproduce 1. Start container with web search enabled docker run -d \   -p 3000:8080 \   -v ollama:/root/.ollama \   -v open-webui:/app/backend/data \   -v /u01/oracle_wallet:/oracle_wallet \   --name open-webui \   --restart unless-stopped \   -e WEBUI_URL="https://<domain-name>" \   -e ENABLE_OAUTH_SIGNUP=False \   -e ENABLE_PERSISTENT_CONFIG=False \   -e VECTOR_DB=oracle23ai \   -e ORACLE_DB_USE_WALLET=True \   -e ORACLE_DB_USER=OPENWEBUI \   -e ORACLE_DB_PASSWORD=<db-password> \   -e ORACLE_DB_DSN=kbvectorstore2_low \   -e ORACLE_WALLET_DIR=/oracle_wallet \   -e ORACLE_WALLET_PASSWORD=<wallet-password>\   -e ORACLE_VECTOR_LENGTH=384 \   -e ORACLE_DB_POOL_MIN=2 \   -e ORACLE_DB_POOL_MAX=10 \   -e ORACLE_DB_POOL_INCREMENT=1 \   -e OAUTH_CLIENT_ID="<client-id>" \   -e OAUTH_CLIENT_SECRET="<client-secret>" \   -e OPENID_PROVIDER_URL="https://<identity-provider>/.well-known/openid-configuration" \   -e OAUTH_PROVIDER_NAME="OCI SSO" \   -e OAUTH_SCOPES="openid email profile" \   -e OPENID_REDIRECT_URI="https://<domain-name>/oauth/oidc/callback" \   -e ENABLE_WEB_SEARCH=True \   -e WEB_SEARCH_ENGINE=perplexity_search \   -e PERPLEXITY_API_KEY="pplx-<api-key>" \   ghcr.io/open-webui/open-webui:ollama 2. enable web search in a new chat and enter a prompt like "what's the weather like in Amsterdam" 3. observe container logs. ### Logs & Screenshots 2025-10-15 17:18:08.029 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 94.207.29.255:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 [GIN] 2025/10/15 - 17:18:38 | 200 | 2m19s | 127.0.0.1 | POST "/api/chat" Fetching pages: 100%|##########| 6/6 [00:02<00:00, 2.55it/s] 2025-10-15 17:18:44.803 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1262 - save_docs_to_vector_db: document Weather - Amsterdam - 14-Day Forecast: Temperature, Wind & Radar | Ventusky, Amsterdam, North Holland, Netherlands Weather Forecast | AccuWeather, Weather - The Hague - 14-Day Forecast: Temperature, Wind & Radar | Ventusky, 10-Day Weather Forecast for Frederik Hendrikbuurt, Amsterdam-West, North Holland, Netherlands - The Weather Channel | weather.com, Weather Forecast and Conditions for Burgwallen-Nieuwe Zijde, Amsterdam-Centrum, North Holland, Netherlands - The Weather Channel | Weather.com, Albany, New York News, Weather, Sports | NEWS10 ABC web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8 2025-10-15 17:18:44.829 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1378 - generating embeddings for web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8 Batches: 100%|██████████| 3/3 [00:01<00:00, 2.43it/s] 2025-10-15 17:18:46.078 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1414 - embeddings generated 86 for 86 items 2025-10-15 17:18:46.080 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1426 - adding to collection web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8 2025-10-15 17:18:46.081 | INFO | open_webui.retrieval.vector.dbs.oracle23ai:insert:421 - Inserting 86 items into collection 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'. 2025-10-15 17:18:46.240 | INFO | open_webui.retrieval.vector.dbs.oracle23ai:insert:446 - Successfully inserted 86 items into collection 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'. 2025-10-15 17:18:46.241 | INFO | open_webui.routers.retrieval:save_docs_to_vector_db:1432 - added 86 items to collection web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8 2025-10-15 17:18:46.257 | ERROR | open_webui.retrieval.utils:get_doc:146 - Error getting doc web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8: cannot access local variable 'limit' where it is not associated with a value Traceback (most recent call last): File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x7506027549a0> └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function Thread.run at 0x750602754680> └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> File "/usr/local/lib/python3.11/threading.py", line 982, in run self._target(*self._args, **self._kwargs) │ │ │ │ │ └ {} │ │ │ │ └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> │ │ │ └ (<weakref at 0x750493dfae30; to 'ThreadPoolExecutor' at 0x7504c1ec3050>, <_queue.SimpleQueue object at 0x750493b00950>, None,... │ │ └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> │ └ <function _worker at 0x7506016565c0> └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 83, in _worker work_item.run() │ └ <function _WorkItem.run at 0x750601656700> └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910> File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) │ │ │ │ │ └ {} │ │ │ │ └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910> │ │ │ └ () │ │ └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910> │ └ <function chat_completion_files_handler.<locals>.<lambda> at 0x750493b0c900> └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910> File "/app/backend/open_webui/utils/middleware.py", line 886, in <lambda> lambda: get_sources_from_items( └ <function get_sources_from_items at 0x75055c21af20> File "/app/backend/open_webui/retrieval/utils.py", line 728, in get_sources_from_items query_result = get_all_items_from_collections(collection_names) │ └ {'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'} └ <function get_all_items_from_collections at 0x75055c21a520> File "/app/backend/open_webui/retrieval/utils.py", line 312, in get_all_items_from_collections result = get_doc(collection_name=collection_name) │ └ 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8' └ <function get_doc at 0x75055c21a700> > File "/app/backend/open_webui/retrieval/utils.py", line 139, in get_doc result = VECTOR_DB_CLIENT.get(collection_name=collection_name) │ │ └ 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8' │ └ <function Oracle23aiClient.get at 0x7505659b6fc0> └ <open_webui.retrieval.vector.dbs.oracle23ai.Oracle23aiClient object at 0x750566443350> File "/app/backend/open_webui/retrieval/vector/dbs/oracle23ai.py", line 716, in get f"Getting items from collection '{collection_name}' with limit {limit}." UnboundLocalError: cannot access local variable 'limit' where it is not associated with a value 2025-10-15 17:18:46.259 | ERROR | open_webui.retrieval.utils:get_all_items_from_collections:316 - Error when querying the collection: cannot access local variable 'limit' where it is not associated with a value Traceback (most recent call last): File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap self._bootstrap_inner() │ └ <function Thread._bootstrap_inner at 0x7506027549a0> └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() │ └ <function Thread.run at 0x750602754680> └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> File "/usr/local/lib/python3.11/threading.py", line 982, in run self._target(*self._args, **self._kwargs) │ │ │ │ │ └ {} │ │ │ │ └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> │ │ │ └ (<weakref at 0x750493dfae30; to 'ThreadPoolExecutor' at 0x7504c1ec3050>, <_queue.SimpleQueue object at 0x750493b00950>, None,... │ │ └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> │ └ <function _worker at 0x7506016565c0> └ <Thread(ThreadPoolExecutor-15_0, started 128658714859200)> File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 83, in _worker work_item.run() │ └ <function _WorkItem.run at 0x750601656700> └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910> File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) │ │ │ │ │ └ {} │ │ │ │ └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910> │ │ │ └ () │ │ └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910> │ └ <function chat_completion_files_handler.<locals>.<lambda> at 0x750493b0c900> └ <concurrent.futures.thread._WorkItem object at 0x750493b2a910> File "/app/backend/open_webui/utils/middleware.py", line 886, in <lambda> lambda: get_sources_from_items( └ <function get_sources_from_items at 0x75055c21af20> File "/app/backend/open_webui/retrieval/utils.py", line 728, in get_sources_from_items query_result = get_all_items_from_collections(collection_names) │ └ {'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8'} └ <function get_all_items_from_collections at 0x75055c21a520> > File "/app/backend/open_webui/retrieval/utils.py", line 312, in get_all_items_from_collections result = get_doc(collection_name=collection_name) │ └ 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8' └ <function get_doc at 0x75055c21a700> File "/app/backend/open_webui/retrieval/utils.py", line 147, in get_doc raise e File "/app/backend/open_webui/retrieval/utils.py", line 139, in get_doc result = VECTOR_DB_CLIENT.get(collection_name=collection_name) │ │ └ 'web-search-8a99e9cc4ece8992b7736ac93a13bcbf9fa12f4a1f0f805ae7b8' │ └ <function Oracle23aiClient.get at 0x7505659b6fc0> └ <open_webui.retrieval.vector.dbs.oracle23ai.Oracle23aiClient object at 0x750566443350> File "/app/backend/open_webui/retrieval/vector/dbs/oracle23ai.py", line 716, in get f"Getting items from collection '{collection_name}' with limit {limit}." UnboundLocalError: cannot access local variable 'limit' where it is not associated with a value 2025-10-15 17:18:53.691 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 94.207.29.255:0 - "GET /_app/version.json HTTP/1.1" 200 [GIN] 2025/10/15 - 17:19:01 | 200 | 54.354498778s | 127.0.0.1 | POST "/api/chat" ### Additional Information open-webui/backend/open_webui/retrieval/vector/dbs/oracle23ai.py local variable limit is missing in procedure get def get(self, collection_name: str) -> Optional[GetResult]: """ Get all items in a collection. Retrieves items from a specified collection up to the limit. Args: collection_name (str): Name of the collection to retrieve limit (Optional[int]): Maximum number of items to retrieve Returns: Optional[GetResult]: Result containing ids, documents, and metadata Example: >>> client = Oracle23aiClient() >>> results = client.get("my_collection", limit=50) >>> if results: ... print(f"Retrieved {len(results.ids[0])} documents from collection") """ log.info( f"Getting items from collection '{collection_name}' with limit {limit}." ) try: limit = limit or 1000 with self.get_connection() as connection: with connection.cursor() as cursor: cursor.execute( """ SELECT /*+ MONITOR */ id, text, JSON_SERIALIZE(vmetadata RETURNING VARCHAR2(4096)) as vmetadata FROM document_chunk WHERE collection_name = :collection_name FETCH FIRST :limit ROWS ONLY """, {"collection_name": collection_name, "limit": limit}, ) results = cursor.fetchall() if not results: log.info("No results found.") return None ids = [[row[0] for row in results]] documents = [ [ row[1].read() if isinstance(row[1], oracledb.LOB) else str(row[1]) for row in results ] ] # 🔧 FIXED: Parse JSON metadata properly metadatas = [ [ self._json_to_metadata( row[2].read() if isinstance(row[2], oracledb.LOB) else row[2] ) for row in results ] ] return GetResult(ids=ids, documents=documents, metadatas=metadatas) except Exception as e: log.exception(f"Error during get: {e}") return None
GiteaMirror added the bug label 2026-04-20 00:47:25 -05:00
Author
Owner

@tjbck commented on GitHub (Oct 15, 2025):

Addressed in dev.

<!-- gh-comment-id:3407959484 --> @tjbck commented on GitHub (Oct 15, 2025): Addressed in 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#18571