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:
defget(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.
🔄 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>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/22665
Author: @mango766
Created: 3/14/2026
Status: ❌ Closed
Base:
main← Head:fix/oracle23ai-unbound-limit-variable📝 Commits (1)
eb43214fix: 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
UnboundLocalErrorinOracle23aiClient.get()where thelimitvariable was referenced in alog.info()call before being assigned, crashing hybrid search for all Oracle 23ai users.limit = 1000assignment before the log statement that references it.limitparameter in the method signature.Details
In
backend/open_webui/retrieval/vector/dbs/oracle23ai.py, theget()method had:Python treats
limitas a local variable throughout the function because of the assignment on line 718. But thelog.info()on line 714 references it before the assignment executes, raising:This crashes the entire hybrid search pipeline:
query_collection_with_hybrid_search()->VECTOR_DB_CLIENT.get()-> crash.The fix simply reorders the statements so
limitis assigned before it is used.Fixes #22664
Related: #22616, #18356
Test plan
oracle23ai.pyget()method no longer raisesUnboundLocalError🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.