[PR #22665] [CLOSED] fix: resolve UnboundLocalError in oracle23ai.py get() method #49853

Closed
opened 2026-04-30 02:14:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22665
Author: @mango766
Created: 3/14/2026
Status: Closed

Base: mainHead: fix/oracle23ai-unbound-limit-variable


📝 Commits (1)

  • eb43214 fix: resolve UnboundLocalError in oracle23ai.py get() method

📊 Changes

1 file changed (+6 additions, -7 deletions)

View changed files

📝 backend/open_webui/retrieval/vector/dbs/oracle23ai.py (+6 -7)

📄 Description

Summary

  • Fix UnboundLocalError in Oracle23aiClient.get() where the limit variable was referenced in a log.info() call before being assigned, crashing hybrid search for all Oracle 23ai users.
  • Move limit = 1000 assignment before the log statement that references it.
  • Fix incorrect docstring that documented a non-existent limit parameter in the method signature.

Details

In backend/open_webui/retrieval/vector/dbs/oracle23ai.py, the get() method had:

def get(self, collection_name: str) -> Optional[GetResult]:
    log.info(
        f"Getting items from collection '{collection_name}' with limit {limit}."  # BUG: limit not yet defined
    )

    try:
        limit = 1000  # defined here, but too late

Python treats limit as a local variable throughout the function because of the assignment on line 718. But the log.info() on line 714 references it before the assignment executes, raising:

UnboundLocalError: cannot access local variable 'limit' where it is not associated with a value

This crashes the entire hybrid search pipeline: query_collection_with_hybrid_search() -> VECTOR_DB_CLIENT.get() -> crash.

The fix simply reorders the statements so limit is assigned before it is used.

Fixes #22664
Related: #22616, #18356

Test plan

  • Verify oracle23ai.py get() method no longer raises UnboundLocalError
  • Confirm hybrid search works end-to-end with Oracle 23ai as vector DB
  • Run existing test suite to ensure no regressions

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/22665 **Author:** [@mango766](https://github.com/mango766) **Created:** 3/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/oracle23ai-unbound-limit-variable` --- ### 📝 Commits (1) - [`eb43214`](https://github.com/open-webui/open-webui/commit/eb43214aca88b6b3e608d0fcde9ee47716655299) fix: resolve UnboundLocalError in oracle23ai.py get() method ### 📊 Changes **1 file changed** (+6 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/retrieval/vector/dbs/oracle23ai.py` (+6 -7) </details> ### 📄 Description ## Summary - Fix `UnboundLocalError` in `Oracle23aiClient.get()` where the `limit` variable was referenced in a `log.info()` call before being assigned, crashing hybrid search for all Oracle 23ai users. - Move `limit = 1000` assignment before the log statement that references it. - Fix incorrect docstring that documented a non-existent `limit` parameter in the method signature. ## Details In `backend/open_webui/retrieval/vector/dbs/oracle23ai.py`, the `get()` method had: ```python def get(self, collection_name: str) -> Optional[GetResult]: log.info( f"Getting items from collection '{collection_name}' with limit {limit}." # BUG: limit not yet defined ) try: limit = 1000 # defined here, but too late ``` Python treats `limit` as a local variable throughout the function because of the assignment on line 718. But the `log.info()` on line 714 references it before the assignment executes, raising: ``` UnboundLocalError: cannot access local variable 'limit' where it is not associated with a value ``` This crashes the entire hybrid search pipeline: `query_collection_with_hybrid_search()` -> `VECTOR_DB_CLIENT.get()` -> crash. The fix simply reorders the statements so `limit` is assigned before it is used. Fixes #22664 Related: #22616, #18356 ## Test plan - [ ] Verify `oracle23ai.py` `get()` method no longer raises `UnboundLocalError` - [ ] Confirm hybrid search works end-to-end with Oracle 23ai as vector DB - [ ] Run existing test suite to ensure no regressions 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 02:14:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#49853