mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-20 20:52:23 -05:00
[PR #19238] [MERGED] fix: Use get_index() instead of list_indexes() in has_collection() to… #128797
Reference in New Issue
Block a user
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/19238
Author: @shargyle
Created: 11/17/2025
Status: ✅ Merged
Merged: 11/19/2025
Merged by: @tjbck
Base:
dev← Head:fix/s3vectors-pagination-has-collection📝 Commits (2)
94a971ffix: Use get_index() instead of list_indexes() in has_collection() to handle pagination4aa56bfUpdate s3vector.py📊 Changes
1 file changed (+13 additions, -11 deletions)
View changed files
📝
backend/open_webui/retrieval/vector/dbs/s3vector.py(+13 -11)📄 Description
fix: Use get_index() instead of list_indexes() in has_collection() to handle pagination
Fixes #19233
Replace list_indexes() pagination scan with direct get_index() lookup
in has_collection() method. The previous implementation only checked
the first ~2,000 indexes due to unhandled pagination, causing RAG
queries to fail for indexes beyond the first page.
Benefits:
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch will lead to immediate closure of the PR.Changelog Entry
Description
Fixed pagination bug in S3 Vectors
has_collection()method that caused RAG queries to fail when the bucket contained more than ~2,000 indexes. The method now uses directget_index()lookup instead of scanninglist_indexes()results, eliminating pagination issues and improving performance by ~8x.Added
Changed
has_collection()method inbackend/open_webui/retrieval/vector/dbs/s3vector.pyto use directget_index()lookup instead oflist_indexes()scanResourceNotFoundExceptionfor non-existent indexesDeprecated
Removed
Fixed
has_collection()returning False for indexes beyond position ~2,000 due to unhandled paginationSecurity
Breaking Changes
Additional Information
Root Cause:
The original implementation used
list_indexes()which returns only ~2,000 indexes by default with anextTokenfor pagination. Without pagination handling, indexes beyond the first page were never found, causing RAG functionality to break in production environments with many files.Testing Details:
Successfully reproduced in dev environment with 2,014 total indexes:
Key Finding:
list_indexes()returns results in alphabetical ordernextToken)Reproduction Steps:
Create 2,000+ dummy indexes to push real
file-*indexes beyond the pagination threshold:Why this works: In a real scenario with 2,000 uploaded files, newer files would similarly be pushed beyond the pagination threshold, replicating production behavior.
Upload a new file via Open WebUI:
Attempt to query the file:
Check logs:
Even though AWS CLI confirms the index exists:
Results:
list_indexes()1.53s, ❌ returns False for indexes beyond position ~1,637, RAG queries failget_index()0.19s, ✅ finds all indexes regardless of position, ~8x fasterRelated Issue: #19233
Screenshots or Videos
N/A - This is a backend bug fix with no UI changes. Testing was performed via:
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.